summaryrefslogtreecommitdiff
path: root/sourcemod/scripting/gokz-global/ban_player.sp
blob: 835d9e51fa557bbeb6b995f8817f24b5555d684b (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
/*
	Globally ban players when they are suspected by gokz-anticheat.
*/



// =====[ PUBLIC ]=====

void GlobalBanPlayer(int client, ACReason reason, const char[] notes, const char[] stats)
{
	char playerName[MAX_NAME_LENGTH], steamid[32], ip[32];
	
	GetClientName(client, playerName, sizeof(playerName));
	GetClientAuthId(client, AuthId_Steam2, steamid, sizeof(steamid));
	GetClientIP(client, ip, sizeof(ip));
	
	DataPack dp = new DataPack();
	dp.WriteString(playerName);
	dp.WriteString(steamid);
	
	switch (reason)
	{
		case ACReason_BhopHack:GlobalAPI_CreateBan(BanPlayerCallback, dp, steamid, "bhop_hack", stats, notes, ip);
		case ACReason_BhopMacro:GlobalAPI_CreateBan(BanPlayerCallback, dp, steamid, "bhop_macro", stats, notes, ip);
	}
}

public int BanPlayerCallback(JSON_Object response, GlobalAPIRequestData request, DataPack dp)
{
	char playerName[MAX_NAME_LENGTH], steamid[32];
	
	dp.Reset();
	dp.ReadString(playerName, sizeof(playerName));
	dp.ReadString(steamid, sizeof(steamid));
	delete dp;
	
	if (request.Failure)
	{
		LogError("Failed to globally ban %s (%s).", playerName, steamid);
	}
	return 0;
}