5 Commits

Author SHA1 Message Date
8834f75f63 add info about configuration options. to readme.md
add info about configuration options.
2020-11-19 08:57:44 +00:00
421ec84702 changed version to 1.2 2020-11-19 02:52:50 -06:00
5ea0dd67c9 add support for changing the default iw4m-admin url through a config file. 2020-11-19 02:51:28 -06:00
69a05e00f5 change version to 1.1 2020-11-17 07:01:11 -06:00
4782ca769b Merge pull request 'Network-id' (#1) from Network-id into master
Reviewed-on: #1
2020-11-17 12:56:56 +00:00
7 changed files with 3506 additions and 10 deletions

View File

@ -167,6 +167,7 @@
<ClInclude Include="functions.h" />
<ClInclude Include="framework.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="SimpleIni.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp" />

View File

@ -30,6 +30,9 @@
<ClInclude Include="functions.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SimpleIni.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">

View File

@ -10,15 +10,9 @@ This C++ Plutonium t6 plugin and C# iw4m-admin plugin are used together to grab
# Installation:
Download the latest ClanTagRank.dll from the release page, and place it in your t6 server under ```./t6r/data/plugins```, and ClanTagRankApi.dll (from https://gitea.insanemode.org/INSANEMODE/ClanTagRankApi ) in your Iw4m-admin folder under ```./Plugins```
- Download the latest ClanTagRank.dll from the release page, and place it in your t6 server under ```./t6r/data/plugins```, and ClanTagRankApi.dll (from https://gitea.insanemode.org/INSANEMODE/ClanTagRankApi ) in your Iw4m-admin folder under ```./Plugins```
# Limitations:
Currently, these plugins require iw4m-admin to be running locally, on the same machine as your servers, and also needs the webfront to be running on the default port, 1624.
if either of these aren't followed, or iw4m-admin is not running, you will see an error in your server's console window that looks similar to this
```curl_easy_perform() failed: Couldn't connect to server```
- Run your server, and GetClanTag.ini will be generated in your ```./t6r/data/plugins``` folder. you can edit the URL in this file to match your iw4m-admin url or port if you aren't running it locally, or if you are not running on the default 1624 port.
# Additional required files/programs
https://github.com/RaidMax/IW4M-Admin/releases

3474
SimpleIni.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,8 @@
void init()
{
std::cout << "ClanTagRank (1.0.4) by INSANEMODE\n";
std::cout << "ClanTagRank (1.2) by INSANEMODE\n";
std::cout << "loaded iw4m-admin url from .\\Plugins\\GetClanTag.ini: " << Game::configfile() << '\n';
std::thread rank(Game::clanTagThread);
rank.detach();
}

View File

@ -8,11 +8,32 @@
#include <thread>
#include <algorithm>
#include "curl\curl.h"
#include "simpleini.h"
#include <filesystem>
#define GetCurrentDir _getcwd
namespace Game
{
std::string configfile()
{
CSimpleIniA ini;
std::string currentpath = std::filesystem::current_path().generic_string();
std::string configfile = currentpath + (R"(/t6r/data/plugins/GetClanTag.ini)");
SI_Error rc = ini.LoadFile(configfile.c_str());
//SI_Error rc = ini.LoadFile("\\t6r\\data\\plugins\\GetClanTag.ini");
if (rc < 0)
{
ini.SetValue("Config", "URL", "127.0.0.1:1624");
ini.SaveFile(configfile.c_str());
};
const char* pVal = ini.GetValue("Config", "URL", "http://127.0.0.1:1624");
return pVal;
}
static size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userp)
{
@ -28,7 +49,7 @@ namespace Game
std::string readBuffer;
curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:1624/api/gsc/clientguid/" + guidstring);
curl_easy_setopt(curl, CURLOPT_URL, configfile() + "/api/gsc/clientguid/" + guidstring);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
/* example.com is redirected, so we tell libcurl to follow redirection */
@ -122,6 +143,7 @@ namespace Game
{
while (true)
{
configfile();
std::this_thread::sleep_for(std::chrono::milliseconds(10000));
clanTagChanger();
}

View File

@ -6,4 +6,5 @@ namespace Game
{
//void Testprint();
void clanTagThread();
std::string configfile();
}