1
0
Fork 0
mirror of https://codeberg.org/spire/sm_whitelist.git synced 2026-06-03 18:24:06 +02:00

trigger ci

This commit is contained in:
Robin Appelman 2020-02-09 23:06:44 +01:00
commit ce58de45cd

View file

@ -3,8 +3,7 @@
#include <cURL> #include <cURL>
#include <tf2> #include <tf2>
public Plugin:myinfo = public Plugin:myinfo = {
{
name = "whitelist.tf downloader", name = "whitelist.tf downloader",
author = "Icewind", author = "Icewind",
description = "Download whitelists from whitelist.tf", description = "Download whitelists from whitelist.tf",
@ -31,16 +30,14 @@ new Handle:output_file = INVALID_HANDLE;
new String:lastId[128] = ""; new String:lastId[128] = "";
new bool:execLast = true; new bool:execLast = true;
public OnPluginStart() public OnPluginStart() {
{
g_hCvarUrl = CreateConVar("sm_whitelist_tf_base", "http://whitelist.tf/download", "whitelist.tf download endpoint", FCVAR_PROTECTED); g_hCvarUrl = CreateConVar("sm_whitelist_tf_base", "http://whitelist.tf/download", "whitelist.tf download endpoint", FCVAR_PROTECTED);
RegConsoleCmd("sm_whitelist_id", DownloadWhiteListAction, "Download and execute a whitelist"); RegConsoleCmd("sm_whitelist_id", DownloadWhiteListAction, "Download and execute a whitelist");
RegConsoleCmd("tftrue_whitelist_id", DownloadWhiteListAction, "Download and execute a whitelist"); RegConsoleCmd("tftrue_whitelist_id", DownloadWhiteListAction, "Download and execute a whitelist");
} }
public Action:DownloadWhiteListAction(client, args) public Action:DownloadWhiteListAction(client, args) {
{
new String:arg[128]; new String:arg[128];
if(args != 1) { if(args != 1) {
@ -58,8 +55,7 @@ public Action:DownloadWhiteListAction(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
public DownloadWhiteList(String:whiteListId[128], bool:exec) public DownloadWhiteList(String:whiteListId[128], bool:exec) {
{
execLast = exec; execLast = exec;
lastId = whiteListId; lastId = whiteListId;
decl String:fullUrl[512]; decl String:fullUrl[512];
@ -79,8 +75,7 @@ public DownloadWhiteList(String:whiteListId[128], bool:exec)
curl_easy_perform_thread(curl, onComplete); curl_easy_perform_thread(curl, onComplete);
} }
public onComplete(Handle:hndl, CURLcode:code) public onComplete(Handle:hndl, CURLcode:code) {
{
CloseHandle(hndl); CloseHandle(hndl);
if(code != CURLE_OK) if(code != CURLE_OK)
{ {
@ -98,8 +93,7 @@ public onComplete(Handle:hndl, CURLcode:code)
return; return;
} }
public execWhiteList(String:whitelist[128]) public execWhiteList(String:whitelist[128]) {
{
decl String:command[512]; decl String:command[512];
PrintToChatAll("Whitelist loaded"); PrintToChatAll("Whitelist loaded");
Format(command, sizeof(command), "mp_tournament_whitelist %s", whitelist); Format(command, sizeof(command), "mp_tournament_whitelist %s", whitelist);