|
Good Little Panda
|
05-02-2013
, 09:08
Re: [ANY] Smacbans 0.1.9
|
#48
|
Local (untested) whitelist version attached. It hasn't been tested and it was written within five minutes, so do yell at me if it doesn't work and I'll repair it after I get off of work. Created on v0.1.9 of the plugin. All the plugin does is check the local KV and if the Steam exists, it returns before any code gets executed.
- smacbans-whitelist.ini goes within /sourcemod/configs/
Modifications for future versions.
Spoiler
PHP Code:
//=== === === === === === === === === === === === === === === === === === === === === === === === ===
//Declare the following outside any prototype (usually at the top)
//=== === === === === === === === === === === === === === === === === === === === === === === === ===
new Handle:g_hWhitelist = INVALID_HANDLE;
new String:g_sWhitelist[PLATFORM_MAX_PATH];
//=== === === === === === === === === === === === === === === === === === === === === === === === ===
//Declare the following within OnPluginStart()
//=== === === === === === === === === === === === === === === === === === === === === === === === ===
BuildPath(Path_SM, g_sWhitelist, sizeof(g_sWhitelist), "configs/smacbans-whitelist.ini");
//=== === === === === === === === === === === === === === === === === === === === === === === === ===
//Add the following code block somewhere OUTSIDE any defined function, i.e. below OnPluginStart's last }
//=== === === === === === === === === === === === === === === === === === === === === === === === ===
public OnMapStart()
{
if(g_hWhitelist != INVALID_HANDLE)
CloseHandle(g_hWhitelist);
g_hWhitelist = CreateTrie();
new Handle:hKeyValues = CreateKeyValues("SMACBANS-WHITELIST");
if(FileToKeyValues(hKeyValues, g_sWhitelist))
{
decl String:sSteam[32];
if(KvGotoFirstSubKey(hKeyValues))
{
do
{
KvGetSectionName(hKeyValues, sSteam, sizeof(sSteam));
if ((StrContains(sSteam, "STEAM_") == 0))
{
//Cheap fix to account for different universes. Complain about it to someone else :3.
SetTrieValue(g_hWhitelist, sSteam, 1);
sSteam[6] = (sSteam[6] == '0') ? '1' : '0';
SetTrieValue(g_hWhitelist, sSteam, 1);
}
}
while (KvGotoNextKey(hKeyValues));
}
}
CloseHandle(hKeyValues);
}
//=== === === === === === === === === === === === === === === === === === === === === === === === ===
//Add the following code after "new status;" within OnClientAuthorized(client, const String:auth[])
//=== === === === === === === === === === === === === === === === === === === === === === === === ===
// Get the whiteliststatus
if(GetTrieValue(g_hWhitelist, auth, status))
{
g_bWasChecked[client] = true;
return;
}
__________________
Last edited by thetwistedpanda; 05-02-2013 at 09:29.
|
|
|
|