summaryrefslogtreecommitdiff
path: root/sourcemod/scripting/gokz-anticheat/commands.sp
blob: a1fbe2e9a3430e735dcc464c136efe32c5a5271f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
void RegisterCommands()
{
	RegAdminCmd("sm_bhopcheck", CommandBhopCheck, ADMFLAG_ROOT, "[KZ] Show bunnyhop stats report including perf ratio and scroll pattern.");
}

public Action CommandBhopCheck(int client, int args)
{
	if (args == 0)
	{
		if (GOKZ_AC_GetSampleSize(client) == 0)
		{
			GOKZ_PrintToChat(client, true, "%t", "Not Enough Bhops (Self)");
		}
		else
		{
			PrintBhopCheckToChat(client, client);
		}
		return Plugin_Handled;
	}
	
	char arg[65];
	GetCmdArg(1, arg, sizeof(arg));
	char targetName[MAX_TARGET_LENGTH];
	int targetList[MAXPLAYERS], targetCount;
	bool tnIsML;
	
	if ((targetCount = ProcessTargetString(
				arg, 
				client, 
				targetList, 
				MAXPLAYERS, 
				COMMAND_FILTER_NO_IMMUNITY | COMMAND_FILTER_NO_BOTS, 
				targetName, 
				sizeof(targetName), 
				tnIsML)) <= 0)
	{
		ReplyToTargetError(client, targetCount);
		return Plugin_Handled;
	}
	
	if (targetCount >= 2)
	{
		GOKZ_PrintToChat(client, true, "%t", "See Console");
		for (int i = 0; i < targetCount; i++)
		{
			if (GOKZ_AC_GetSampleSize(targetList[i]) == 0)
			{
				PrintToConsole(client, "%t", "Not Enough Bhops (Console)", targetList[i]);
			}
			else
			{
				PrintBhopCheckToConsole(client, targetList[i]);
			}
		}
	}
	else
	{
		if (GOKZ_AC_GetSampleSize(targetList[0]) == 0)
		{
			if (targetList[0] == client)
			{
				GOKZ_PrintToChat(client, true, "%t", "Not Enough Bhops (Self)");
			}
			else
			{
				GOKZ_PrintToChat(client, true, "%t", "Not Enough Bhops", targetList[0]);
			}
		}
		else
		{
			PrintBhopCheckToChat(client, targetList[0]);
		}
	}
	
	return Plugin_Handled;
}