added cookie to bhop command
This commit is contained in:
parent
dcc48282a7
commit
2920011832
@ -1,6 +1,7 @@
|
||||
#pragma semicolon 1
|
||||
#pragma newdecls required
|
||||
|
||||
#include <clientprefs>
|
||||
#include <sourcemod>
|
||||
#include <sdkhooks>
|
||||
#include <PhysHooks>
|
||||
@ -31,6 +32,8 @@ int g_ActiveLimitedFlags = LIMITED_GENERAL | LIMITED_PLUGIN;
|
||||
|
||||
StringMap g_ClientLimitedCache;
|
||||
|
||||
Handle g_hCookie_BlockBhop;
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "Selective Bunnyhop",
|
||||
@ -54,6 +57,8 @@ public void OnPluginStart()
|
||||
|
||||
g_ClientLimitedCache = new StringMap();
|
||||
|
||||
g_hCookie_BlockBhop = RegClientCookie("blocking_bhop_cookie", "", CookieAccess_Private);
|
||||
|
||||
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
|
||||
|
||||
RegAdminCmd("sm_bhop", Command_Bhop, ADMFLAG_GENERIC, "sm_bhop <#userid|name> <0|1>");
|
||||
@ -68,12 +73,26 @@ public void OnPluginStart()
|
||||
|
||||
if(ZR_IsClientZombie(i))
|
||||
AddLimitedFlag(i, LIMITED_ZOMBIE);
|
||||
if(AreClientCookiesCached(i))
|
||||
OnClientCookiesCached(i);
|
||||
}
|
||||
|
||||
UpdateLimitedFlags();
|
||||
UpdateClients();
|
||||
}
|
||||
|
||||
public void OnClientCookiesCached(int client)
|
||||
{
|
||||
char sBuffer[16];
|
||||
GetClientCookie(client, g_hCookie_BlockBhop, sBuffer, sizeof(sBuffer));
|
||||
|
||||
if (StrEqual(sBuffer, "1", false))
|
||||
{
|
||||
AddLimitedFlag(client, LIMITED_GENERAL);
|
||||
g_ClientLimited[client] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
|
||||
{
|
||||
CreateNative("LimitBhop", Native_LimitBhop);
|
||||
@ -315,12 +334,21 @@ public Action Command_Bhop(int client, int argc)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
char sBuffer[16];
|
||||
for(int i = 0; i < iTargetCount; i++)
|
||||
{
|
||||
if(bValue)
|
||||
{
|
||||
RemoveLimitedFlag(iTargets[i], LIMITED_GENERAL | LIMITED_PLUGIN);
|
||||
Format(sBuffer, sizeof(sBuffer), "%s", "0");
|
||||
SetClientCookie(iTargets[i], g_hCookie_BlockBhop, sBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddLimitedFlag(iTargets[i], LIMITED_GENERAL);
|
||||
Format(sBuffer, sizeof(sBuffer), "%s", "1");
|
||||
SetClientCookie(iTargets[i], g_hCookie_BlockBhop, sBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
ShowActivity2(client, "\x01[SM] \x04", "\x01\x04%s\x01 bunnyhop on target \x04%s", bValue ? "Un-limited" : "Limited", sTargetName);
|
||||
|
Loading…
Reference in New Issue
Block a user