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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
void RegisterCommands()
{
RegConsoleCmd("sm_savetimersetup", Command_SaveTimerSetup, "[KZ] Save the current timer setup (virtual buttons and start position).");
RegConsoleCmd("sm_sts", Command_SaveTimerSetup, "[KZ] Save the current timer setup (virtual buttons and start position).");
RegConsoleCmd("sm_loadtimersetup", Command_LoadTimerSetup, "[KZ] Load the saved timer setup (virtual buttons and start position).");
RegConsoleCmd("sm_lts", Command_LoadTimerSetup, "[KZ] Load the saved timer setup (virtual buttons and start position).");
RegAdminCmd("sm_setcheater", CommandSetCheater, ADMFLAG_ROOT, "[KZ] Set a SteamID as a cheater. Usage: !setcheater <STEAM_1:X:X>");
RegAdminCmd("sm_setnotcheater", CommandSetNotCheater, ADMFLAG_ROOT, "[KZ] Set a SteamID as not a cheater. Usage: !setnotcheater <STEAM_1:X:X>");
RegAdminCmd("sm_deletebestjump", CommandDeleteBestJump, ADMFLAG_ROOT, "[KZ] Remove the top jumpstat of a SteamID. Usage: !deletebestjump <STEAM_1:X:X> <mode> <jump type> <block?>");
RegAdminCmd("sm_deletealljumps", CommandDeleteAllJumps, ADMFLAG_ROOT, "[KZ] Remove all jumpstats of a SteamID. Usage: !deletealljumps <STEAM_1:X:X>");
RegAdminCmd("sm_deletejump", CommandDeleteJump, ADMFLAG_ROOT, "[KZ] Remove a jumpstat by it's id. Usage: !deletejump <id>");
RegAdminCmd("sm_deletetime", CommandDeleteTime, ADMFLAG_ROOT, "[KZ] Remove a time by it's id. Usage: !deletetime <id>");
}
public Action Command_SaveTimerSetup(int client, int args)
{
DB_SaveTimerSetup(client);
return Plugin_Handled;
}
public Action Command_LoadTimerSetup(int client, int args)
{
DB_LoadTimerSetup(client, true);
return Plugin_Handled;
}
public Action CommandSetCheater(int client, int args)
{
if (args == 0)
{
GOKZ_PrintToChat(client, true, "%t", "No SteamID specified");
return Plugin_Handled;
}
char steamID2[64];
GetCmdArgString(steamID2, sizeof(steamID2));
int steamAccountID = Steam2ToSteamAccountID(steamID2);
if (steamAccountID == -1)
{
GOKZ_PrintToChat(client, true, "%t", "Invalid SteamID");
}
else
{
DB_SetCheaterSteamID(client, steamAccountID, true);
}
return Plugin_Handled;
}
public Action CommandSetNotCheater(int client, int args)
{
if (args == 0)
{
GOKZ_PrintToChat(client, true, "%t", "No SteamID specified");
}
char steamID2[64];
GetCmdArgString(steamID2, sizeof(steamID2));
int steamAccountID = Steam2ToSteamAccountID(steamID2);
if (steamAccountID == -1)
{
GOKZ_PrintToChat(client, true, "%t", "Invalid SteamID");
}
else
{
DB_SetCheaterSteamID(client, steamAccountID, false);
}
return Plugin_Handled;
}
public Action CommandDeleteBestJump(int client, int args)
{
if (args < 3)
{
GOKZ_PrintToChat(client, true, "%t", "Delete Best Jump Usage");
return Plugin_Handled;
}
int steamAccountID, isBlock, mode, jumpType;
char query[1024], split[4][32];
// Get arguments
split[3][0] = '\0';
GetCmdArgString(query, sizeof(query));
ExplodeString(query, " ", split, 4, 32, false);
// SteamID32
steamAccountID = Steam2ToSteamAccountID(split[0]);
if (steamAccountID == -1)
{
GOKZ_PrintToChat(client, true, "%t", "Invalid SteamID");
return Plugin_Handled;
}
// Mode
for (mode = 0; mode < MODE_COUNT; mode++)
{
if (StrEqual(split[1], gC_ModeNames[mode]) || StrEqual(split[1], gC_ModeNamesShort[mode], false))
{
break;
}
}
if (mode == MODE_COUNT)
{
GOKZ_PrintToChat(client, true, "%t", "Invalid Mode");
return Plugin_Handled;
}
// Jumptype
for (jumpType = 0; jumpType < JUMPTYPE_COUNT; jumpType++)
{
if (StrEqual(split[2], gC_JumpTypes[jumpType]) || StrEqual(split[2], gC_JumpTypesShort[jumpType], false))
{
break;
}
}
if (jumpType == JUMPTYPE_COUNT)
{
GOKZ_PrintToChat(client, true, "%t", "Invalid Jumptype");
return Plugin_Handled;
}
// Is it a block jump?
isBlock = StrEqual(split[3], "yes", false) || StrEqual(split[3], "true", false) || StrEqual(split[3], "1");
DB_DeleteBestJump(client, steamAccountID, jumpType, mode, isBlock);
return Plugin_Handled;
}
public Action CommandDeleteAllJumps(int client, int args)
{
if (args < 1)
{
GOKZ_PrintToChat(client, true, "%t", "Delete All Jumps Usage");
return Plugin_Handled;
}
int steamAccountID;
char steamid[32];
GetCmdArgString(steamid, sizeof(steamid));
steamAccountID = Steam2ToSteamAccountID(steamid);
if (steamAccountID == -1)
{
GOKZ_PrintToChat(client, true, "%t", "Invalid SteamID");
return Plugin_Handled;
}
DB_DeleteAllJumps(client, steamAccountID);
return Plugin_Handled;
}
public Action CommandDeleteJump(int client, int args)
{
if (args < 1)
{
GOKZ_PrintToChat(client, true, "%t", "Delete Jump Usage");
return Plugin_Handled;
}
char buffer[24];
int jumpID;
GetCmdArgString(buffer, sizeof(buffer));
if (StringToIntEx(buffer, jumpID) == 0)
{
GOKZ_PrintToChat(client, true, "%t", "Invalid Jump ID");
return Plugin_Handled;
}
DB_DeleteJump(client, jumpID);
return Plugin_Handled;
}
public Action CommandDeleteTime(int client, int args)
{
if (args < 1)
{
GOKZ_PrintToChat(client, true, "%t", "Delete Time Usage");
return Plugin_Handled;
}
char buffer[24];
int timeID;
GetCmdArgString(buffer, sizeof(buffer));
if (StringToIntEx(buffer, timeID) == 0)
{
GOKZ_PrintToChat(client, true, "%t", "Invalid Time ID");
return Plugin_Handled;
}
DB_DeleteTime(client, timeID);
return Plugin_Handled;
}
|