· 9 years ago · Nov 26, 2016, 05:24 PM
1/*
2 Plugin antiroxx:source 3.8 (zz1crazyxx & MorgenDavid)
3 plugin de diminution des degats en fonction du niveau des joueurs.(classement par ratio)
4 systeme de protection des joueurs tres faible (luciolle)
5*/
6
7/*
8 // La table stock le ratio des joueurs sous forme kill/death
9 // Ip et lastconnected juste pour info.
10 // Si plx=x le joueur peut se co sans risque d'etre redirige x=1 low, x=2 high , x=3 les deux.
11
12 CVars:
13 * antiroxx_active" (default:"1") "(Des)active antiroxx"
14 * antiroxx_minimum_player" (default:"4") "Nbres Joueurs minimum pour etre actif"
15 * antiroxx_serveur (default:"0") "0 = Normal | 1 = Serveur Low (kick/redirige si trop fort): 2 = Serveur High (kick/redirige si trop faible)"
16 * antiroxx_ratio_auth (default:"1.00") "Si 'Serveur Low' alors ratio maximum avant kick | Si 'Serveur High':ratio minimum sinon kick"
17 * antiroxx_new_server" (default:"127.0.0.1:27015") "Ip du serveur vers lequel on redirigera le joueur (Serveur Low/High)."
18 * antiroxx_max_cumul" (default:"80") "Nombre de frags ou deaths limite, on divise par 2 une fois cette limite atteinte."
19 * antiroxx_ratio_snipe" (default:"1.00") "A partir de ce ratio: on a plus le droit aux snipes (except scout)"
20 * antiroxx_ratio_flash" (default:"1.00") "A partir de ce ratio: on a plus le droit aux flash (a l'achat)"
21 * antiroxx_frags_default" (default:"8") "Nombre de frag donné a chaque joueur a la premiere connection"
22 * antiroxx_deaths_default" (default:"10") "Nombre de morts donne a chaque joueur a la premiere connection"
23
24 Commande:
25 * Liste des ratios des joueurs: sm_antiroxx
26 * Modifier le ratio d'un joueurs: sm_antiroxx <name|#userid> <frag> <death>
27
28 Inclut:
29 * Simple Anti AFK.
30 * 15000 a chaque round.
31*/
32
33#pragma semicolon 1
34
35#include <sourcemod>
36#include <cstrike>
37#include <sdktools>
38#include <sdkhooks>
39#include <colors>
40
41// --------------------------------------------------------------------------------------------------------
42// Les definitions.
43// (Ne pas toucher sans une bonne raison)
44// --------------------------------------------------------------------------------------------------------
45#define PL_VERSION "3.8"
46#define GAME_CSS 1
47#define GAME_CSGO 2
48#define MAX_AUTHID_LENGTH 20
49
50#define RATIO_LUCIOLE -0.05+RATIO_JUNIOR
51#define RATIO_JUNIOR -0.10+RATIO_DEBUTANT
52#define RATIO_DEBUTANT -0.10+RATIO_DEBUTANT_PLUS
53#define RATIO_DEBUTANT_PLUS -0.10+RATIO_CONFIRME
54#define RATIO_CONFIRME 1.00
55#define RATIO_CONFIRME_PLUS 0.05+RATIO_CONFIRME
56#define RATIO_AVANCE 0.05+RATIO_CONFIRME_PLUS
57#define RATIO_AVANCE_PLUS 0.05+RATIO_AVANCE
58#define RATIO_PRO 0.05+RATIO_AVANCE_PLUS
59#define RATIO_PRO_PLUS 0.05+RATIO_PRO
60#define RATIO_PGM 0.10+RATIO_PRO_PLUS
61
62#define START_MONEY 15000
63#define HP_LUCIOLE 200
64#define HP_JUNIOR 150
65#define HP_PGM_CSS 500
66#define HP_PGM_CSGO 200
67
68#define HANDICAP 0.7
69
70#define GROUP_SNIPE 5
71#define GROUP_FLASH 6
72#define GROUP_WORLD 7
73#define GROUP_OTHERS 0
74
75// --------------------------------------------------------------------------------------------------------
76//- Infos Plugins
77// --------------------------------------------------------------------------------------------------------
78public Plugin:myinfo =
79{
80 name = "Antiroxx:Source",
81 author = "zz1crazyxx & MorgenDavid",
82 description = "Plugins d'aide aux nouveaux joueurs",
83 version = PL_VERSION,
84 url = ""
85}
86
87// --------------------------------------------------------------------------------------------------------
88//- Variables
89// --------------------------------------------------------------------------------------------------------
90new Player_Frags[MAXPLAYERS+1];
91new Player_Deaths[MAXPLAYERS+1];
92new Float:Player_Ratio[MAXPLAYERS+1];
93new isPlayerLuciole[MAXPLAYERS+1];
94new isPlayerPgm[MAXPLAYERS+1];
95new isPunished[MAXPLAYERS+1];
96new plx[MAXPLAYERS+1];
97new bool:isConfigDownload[MAXPLAYERS+1];
98new Handle:hDatabase = INVALID_HANDLE;
99
100new TimePlayed[MAXPLAYERS+1];
101
102new Handle:g_hAfkCheckSpawn[MAXPLAYERS+1] = INVALID_HANDLE;
103new Handle:g_hAfkCheckTimer[MAXPLAYERS+1] = INVALID_HANDLE;
104new Float:SpawnPos[MAXPLAYERS+1][3];
105new Float:CurrentPos[MAXPLAYERS+1][3];
106
107// new g_iAccount = -1;
108new Float:g_handicap = HANDICAP;
109
110new Handle:gServeur;
111new Handle:gActive;
112new Handle:gMinimumPly;
113new Handle:gMaxCumul;
114new Handle:gRatioAuth;
115new Handle:gNewServer;
116
117new gametype = -1;
118
119new bool:cvar_Active;
120new cvar_MinimumPly;
121
122new g_FreezeSprite;
123
124new Handle:gRatio_snipe;
125new Float:cvar_snipe;
126
127new Handle:gRatio_flash;
128new Float:cvar_flash;
129
130new Handle:gFrags_default;
131new Handle:gDeaths_default;
132
133// --------------------------------------------------------------------------------------------------------
134//- appelé quand le plugin démarre.
135// --------------------------------------------------------------------------------------------------------
136public OnPluginStart()
137{
138 LoadTranslations ("antiroxx.phrases");
139
140 new String:game_description[64];
141 GetGameDescription(game_description, sizeof(game_description), true);
142 if(StrContains(game_description, "Counter-Strike", false) != -1) { gametype = GAME_CSS; }
143 if(StrContains(game_description, "Counter-Strike: Global Offensive", false) != -1) { gametype = GAME_CSGO; }
144 if(gametype == -1) { SetFailState("Plugin for CS:S or CS:GO only"); }
145
146 //CVar
147 CreateConVar("antiroxx_version", PL_VERSION, "Antiroxx system", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
148 gServeur = CreateConVar("antiroxx_serveur", "0", "0 = Normal | 1 = Low : 2 = High", _, true, 0.0, true, 2.0);
149 gRatioAuth = CreateConVar("antiroxx_ratio_auth", "1.00", "Si 'Low' alors ratio maximum avant kick | Si 'High':ratio minimum sinon kick", _, true, RATIO_LUCIOLE, true, RATIO_PGM);
150 gNewServer = CreateConVar("antiroxx_new_server", "127.0.0.1:27015", "Ip du serveur vers lequel on redirigera le joueur.", _);
151 gActive = CreateConVar("antiroxx_active", "1", "(Des)active antiroxx", _, true, 0.0, true, 1.0);
152 gMinimumPly = CreateConVar("antiroxx_minimum_player", "4", "Nbres Joueurs minimum pour etre actif", _, true, 1.0, true, 8.0);
153 gMaxCumul = CreateConVar("antiroxx_max_cumul", "80", "Nombre de frags ou deaths limite, on divise par 2 une fois cette limite atteinte.", _, true, 60.0, true, 1000.0);
154 gRatio_snipe = CreateConVar("antiroxx_ratio_snipe", "1.00", "A partir de ce ratio: on a plus le droit aux snipes", _, true, RATIO_LUCIOLE, true, RATIO_PGM);
155 gRatio_flash = CreateConVar("antiroxx_ratio_flash", "1.00", "A partir de ce ratio: on a plus le droit aux flash", _, true, RATIO_LUCIOLE, true, RATIO_PGM);
156 gFrags_default = CreateConVar("antiroxx_frags_default", "8", "Nombre de frag donné a chaque joueur a la premiere connection", _, true, 1.0, true, 100.0);
157 gDeaths_default = CreateConVar("antiroxx_deaths_default", "10", "Nombre de morts donne a chaque joueur a la premiere connection", _, true, 1.0, true, 29.0);
158
159 //Events
160 HookEvent("item_pickup", Event_ItemPickup, EventHookMode_Pre);
161 HookEvent("player_death", Event_PlayerDeath);
162 HookEvent("player_hurt", Event_PlayerHurt, EventHookMode_Post);
163 HookEvent("player_spawn", Event_PlayerSpawn);
164 HookEvent("round_start", Event_RoundStart);
165 HookEvent("round_end", Event_RoundEnd);
166
167// g_iAccount = FindSendPropOffs("CCSPlayer", "m_iAccount");
168
169 //Commandes
170 RegAdminCmd("sm_antiroxx", Antiroxx_List, ADMFLAG_BAN);
171
172 AutoExecConfig(true, "antiroxx_source", "sourcemod");
173
174 new String:error[255];
175 if(SQL_CheckConfig("antiroxx"))
176 {
177 hDatabase = SQL_Connect( "antiroxx", true, error, sizeof(error));
178 }
179 else
180 {
181 // hDatabase=SQL_DefConnect( error, sizeof(error), true);
182 new Handle:kv = INVALID_HANDLE;
183 kv = CreateKeyValues("");
184 KvSetString(kv, "driver", "mysql");
185 KvSetString(kv, "database", "web_14463");
186 KvSetString(kv, "host", "149.202.86.230");
187 KvSetString(kv, "port", "3306");
188 KvSetString(kv, "user", "web_14463");
189 KvSetString(kv, "pass", "cDlsdwgdFl");
190 hDatabase = SQL_ConnectCustom(kv, error, sizeof(error), true);
191 CloseHandle(kv);
192 }
193
194 if(hDatabase==INVALID_HANDLE)
195 {
196 PrintToServer("[ANTIROXX] Could not connect: %s", error);
197 LogError("[ANTIROXX] Database failure: %s", error);
198 }
199 else
200 {
201 decl String:query[512];
202 Format(query,sizeof(query), "%s%s%s%s%s%s%s%s%s%s%s",
203 "CREATE TABLE IF NOT EXISTS `css_players` (",
204 " `steamid` varchar(12) NOT NULL,",
205 " `pseudo` tinytext,",
206 " `frag` smallint(5) unsigned NOT NULL,",
207 " `death` smallint(5) unsigned NOT NULL,",
208 " `ip` varchar(15) DEFAULT NULL,",
209 " `LastConnected` timestamp NULL DEFAULT NULL,",
210 " `timeplayed` timestamp NOT NULL DEFAULT 0,",
211 " `plx` tinyint(3) unsigned NOT NULL DEFAULT '0',",
212 " PRIMARY KEY (`steamid`)",
213 ") TYPE=InnoDB;");
214 SQL_TQuery(hDatabase, SQLErrorCheckCallback, query);
215 }
216
217 if(GetConVarInt(gServeur)!=0) g_handicap -= 0.1;
218 if(gametype == GAME_CSGO) g_handicap -= 0.2;
219}
220
221// --------------------------------------------------------------------------------------------------------
222//- Error Query
223// --------------------------------------------------------------------------------------------------------
224public SQLErrorCheckCallback(Handle:owner, Handle:hndl, const String:error[], any:data) {
225 if(!StrEqual("", error)) {
226 LogError("Query failed: %s", error);
227 }
228}
229
230// --------------------------------------------------------------------------------------------------------
231//- Au chargement de la map
232// --------------------------------------------------------------------------------------------------------
233public OnMapStart()
234{
235 if(gametype == GAME_CSS)
236 {
237 // tinkywinky_css
238 AddFileToDownloadsTable("models/player/vad36santa/blue.dx80.vtx");
239 AddFileToDownloadsTable("models/player/vad36santa/blue.dx90.vtx");
240 AddFileToDownloadsTable("models/player/vad36santa/blue.mdl");
241 AddFileToDownloadsTable("models/player/vad36santa/blue.phy);
242 AddFileToDownloadsTable("models/player/vad36santa/blue.sw.vtx");
243 AddFileToDownloadsTable("models/player/vad36santa/blue.vvd");
244 PrecacheModel("models/player/vad36santa/blue.mdl");
245
246 // po_css
247 AddFileToDownloadsTable(models/player/vad36santa/red.dx80.vtx");
248 AddFileToDownloadsTable("models/player/vad36santa/red.dx90.vtx");
249 AddFileToDownloadsTable("models/player/vad36santa/red.mdl");
250 AddFileToDownloadsTable("models/player/vad36santa/red.phy");
251 AddFileToDownloadsTable("models/player/vad36santa/red.sw.vtx");
252 AddFileToDownloadsTable("models/player/vad36santa/red.vvd");
253 PrecacheModel("models/player/vad36santa/red.mdl");
254
255 // pgm_ct
256 AddFileToDownloadsTable("models/player/vad36lollipop/lolli.sw.vtx");
257 AddFileToDownloadsTable("models/player/vad36lollipop/lolli.vvd");
258 AddFileToDownloadsTable("models/player/vad36lollipop/lolli.dx80.vtx");
259 AddFileToDownloadsTable("models/player/vad36lollipop/lolli.dx90.vtx");
260 AddFileToDownloadsTable("models/player/vad36lollipop/lolli.mdl");
261 AddFileToDownloadsTable("models/player/vad36lollipop/lolli.phy");
262 AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_skin_d_cos11.vtf");
263 AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_skin_n_cos11.vtf");
264 AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_cloth_d_cos11.vmt");
265 AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_cloth_d_cos11.vtf");
266 AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_cloth_n_cos11.vtf");
267 AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_hair_d_cos11.vmt");
268 AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_hair_d_cos11.vtf");
269 AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_hair_n_cos11.vtf");
270 AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_skin_d_cos11.vmt");
271 PrecacheModel("models/player/vad36lollipop/lolli.mdl");
272
273 /// pgm_t
274 AddFileToDownloadsTable("models/player/vad36lollipop/lolli_new.vvd");
275 AddFileToDownloadsTable("models/player/vad36lollipop/lolli_new.dx80.vtx");
276 AddFileToDownloadsTable("models/player/vad36lollipop/lolli_new.dx90.vtx");
277 AddFileToDownloadsTable("models/player/vad36lollipop/lolli_new.mdl");
278 AddFileToDownloadsTable("models/player/vad36lollipop/lolli_new.phy");
279 AddFileToDownloadsTable("models/player/vad36lollipop/lolli_new.sw.vtx");
280 AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_skin_d_cos11.vtf");
281 AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_skin_n_cos11.vtf");
282 AddFileToDownloadsTable("materials/models/player/vad36lollipop/hat.vmt");
283 AddFileToDownloadsTable("materials/models/player/vad36lollipop/hat.vtf");
284 AddFileToDownloadsTable("materials/models/player/vad36lollipop/hat_n.vtf");
285 AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_cloth.vmt");
286 AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_cloth.vtf");
287 AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_cloth_n.vtf");
288 AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_hair_d_cos11.vmt");
289 AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_hair_d_cos11.vtf");
290 AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_hair_n_cos11.vtf");
291 AddFileToDownloadsTable("materials/models/player/vad36lollipop/tx_ch_main_juliet_skin_d_cos11.vmt");
292 PrecacheModel("models/player/vad36lollipop/lolli_new.mdl");
293 }
294
295// if(gametype == GAME_CSGO)
296// {
297// // luciolle_red
298// AddFileToDownloadsTable("models/player/luciolle_red/luciolle_red.dx80.vtx");
299// AddFileToDownloadsTable("models/player/luciolle_red/luciolle_red.dx90.vtx");
300// AddFileToDownloadsTable("models/player/luciolle_red/luciolle_red.mdl");
301// AddFileToDownloadsTable("models/player/luciolle_red/luciolle_red.sw.vtx");
302// AddFileToDownloadsTable("models/player/luciolle_red/luciolle_red.vvd");
303// AddFileToDownloadsTable("materials/models/player/luciolle_red/luciolle_red.vtf");
304// AddFileToDownloadsTable("materials/models/player/luciolle_red/luciolle_red_normal.vtf");
305// AddFileToDownloadsTable("materials/models/player/luciolle_red/lightwarp2.vtf");
306// AddFileToDownloadsTable("materials/models/player/luciolle_red/luciolle_red.vmt");
307// PrecacheModel("models/player/luciolle_red/luciolle_red.mdl");
308//
309// // luciolle_blue
310// AddFileToDownloadsTable("models/player/luciolle_blue/luciolle_blue.dx80.vtx");
311// AddFileToDownloadsTable("models/player/luciolle_blue/luciolle_blue.dx90.vtx");
312// AddFileToDownloadsTable("models/player/luciolle_blue/luciolle_blue.mdl");
313// AddFileToDownloadsTable("models/player/luciolle_blue/luciolle_blue.sw.vtx");
314// AddFileToDownloadsTable("models/player/luciolle_blue/luciolle_blue.vvd");
315// AddFileToDownloadsTable("materials/models/player/luciolle_blue/luciolle_blue.vtf");
316// AddFileToDownloadsTable("materials/models/player/luciolle_blue/luciolle_blue_normal.vtf");
317// AddFileToDownloadsTable("materials/models/player/luciolle_blue/lightwarp2.vtf");
318// AddFileToDownloadsTable("materials/models/player/luciolle_blue/luciolle_blue.vmt");
319// PrecacheModel("models/player/luciolle_blue/luciolle_blue.mdl");
320// }
321
322 AddFileToDownloadsTable("sound/fr/rougbleu.wav");
323 PrecacheSound("fr/rougbleu.wav", true);
324
325 g_FreezeSprite=PrecacheModel("sprites/blueglow2.vmt");
326 PrecacheSound("physics/glass/glass_impact_bullet4.wav", true);
327}
328
329// --------------------------------------------------------------------------------------------------------
330//- Hook sur dommages recus
331// --------------------------------------------------------------------------------------------------------
332public OnClientPutInServer( client)
333{
334 SDKHook( client, SDKHook_OnTakeDamage, OnTakeDamage);
335 SDKHook( client, SDKHook_WeaponCanUse, OnWeaponCanUse);
336}
337
338// --------------------------------------------------------------------------------------------------------
339//- Charge les informations de ratio du joueur.
340// --------------------------------------------------------------------------------------------------------
341public T_CheckSteamID( Handle:owner, Handle:hndl, const String:error[], any:client)
342{
343 if(!IsClientConnected( client)) return;
344 if(hndl == INVALID_HANDLE)
345 {
346 LogError("[ANTIROXX] Query failed! %s", error);
347 KickClient(client, "[ANTIROXX] Authorization failed");
348 return;
349 }
350 else if(!SQL_GetRowCount(hndl))
351 {
352 decl String:auth[MAX_AUTHID_LENGTH];
353 GetClientAuthString(client, auth, sizeof(auth));
354 decl String:steamid[MAX_AUTHID_LENGTH-8];
355 Format(steamid,sizeof(steamid),"%s",auth[8]);
356
357 new String:query[150];
358 Format(query, sizeof(query), "insert into css_players (steamid, frag, death) values ('%s',%d, %d)", steamid, Player_Frags[client], Player_Deaths[client]);
359 SQL_LockDatabase(hDatabase);
360 if(!SQL_FastQuery(hDatabase, query))
361 {
362 new String:errorsql[255];
363 SQL_GetError(hDatabase, errorsql, sizeof(errorsql));
364 PrintToServer("[ANTIROXX] Failed to query (error: %s)", errorsql);
365 LogError("[ANTIROXX] %s", query);
366 }
367 SQL_UnlockDatabase(hDatabase);
368 plx[client] = 0;
369 }
370 else
371 {
372 SQL_FetchRow(hndl);
373 Player_Frags[client] = SQL_FetchInt(hndl,0);
374 Player_Deaths[client] = SQL_FetchInt(hndl,1);
375 plx[client] = SQL_FetchInt(hndl,2);
376 }
377 Player_Ratio[client]=float(Player_Frags[client])/float(Player_Deaths[client]);
378 CheckKick(client);
379 isConfigDownload[client] = true;
380}
381
382// --------------------------------------------------------------------------------------------------------
383//- Lance la requete de chargement du ratio du joueur.
384// --------------------------------------------------------------------------------------------------------
385CheckSteamID(userid, const String:auth[])
386{
387 decl String:query[255];
388 Format(query, sizeof(query), "SELECT frag, death, plx FROM css_players WHERE steamid = '%s'", auth);
389 SQL_TQuery(hDatabase, T_CheckSteamID, query, userid);
390}
391
392// --------------------------------------------------------------------------------------------------------
393//- Interdit les armes pour le PGM
394// --------------------------------------------------------------------------------------------------------
395public Action:OnWeaponCanUse(client, weapon)
396{
397 if(isPlayerPgm[client])
398 {
399 new String:gweapon[64];
400 GetEntityClassname(weapon, gweapon, sizeof(gweapon));
401 if(!StrEqual(gweapon,"weapon_knife")
402 && !StrEqual(gweapon,"weapon_hegrenade")
403 && !StrEqual(gweapon,"weapon_smokegrenade")
404 && !StrEqual(gweapon,"weapon_flashbang")
405 && !StrEqual(gweapon,"weapon_c4"))
406 return Plugin_Handled;
407 }
408 return Plugin_Continue;
409}
410
411// --------------------------------------------------------------------------------------------------------
412//- Quand on recois des dommages (AVANT application des dommages)
413// --------------------------------------------------------------------------------------------------------
414public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
415{
416 if((attacker>0 && attacker<=MaxClients) && (victim>0 && victim<=MaxClients))
417 {
418 decl String:Weapon[32];
419 GetClientWeapon(attacker, Weapon, sizeof(Weapon));
420 if(StrEqual(Weapon, "weapon_knife")) return Plugin_Continue;
421 if(!(damagetype & DMG_BULLET)) return Plugin_Continue;
422 if(Player_Ratio[attacker]>RATIO_CONFIRME)
423 {
424 if(Player_Ratio[attacker]>Player_Ratio[victim])
425 {
426 new Float:NewDamage=(g_handicap-(Player_Ratio[attacker]-Player_Ratio[victim]))*damage;
427 if(NewDamage<0.0) NewDamage=0.0;
428 // CPrintToChat(attacker, "{green}[ANTIROXX] {olive} Damage: %5.0f NewDamage: %5.0f", damage, NewDamage);
429 damage=NewDamage;
430 return Plugin_Changed;
431 }
432 }
433 }
434 return Plugin_Continue;
435}
436
437// --------------------------------------------------------------------------------------------------------
438//- Affiche la liste des ratio des joueurs et permets de les modifier.
439// --------------------------------------------------------------------------------------------------------
440public Action:Antiroxx_List(client, args)
441{
442 if(!cvar_Active) return Plugin_Continue;
443
444 new AdminId:targetAdmin = GetUserAdmin(client);
445
446 if (targetAdmin != INVALID_ADMIN_ID)
447 {
448 if(args>=3 && (GetAdminImmunityLevel(targetAdmin) >= 90))
449 {
450 new String:arg1[32], String:arg2[32], String:arg3[32];
451 new Frag, Death;
452 if(GetCmdArg(1, arg1, sizeof(arg1)) && GetCmdArg(2, arg2, sizeof(arg2)) && GetCmdArg(3, arg3, sizeof(arg3)))
453 {
454 new target=FindTarget(client, arg1);
455 if(target == -1)
456 {
457 return Plugin_Handled;
458 }
459 Frag = StringToInt(arg2);
460 Death = StringToInt(arg3);
461 new cvar_deaths_default=GetConVarInt(gDeaths_default);
462 if(Death<=(cvar_deaths_default+10))
463 {
464 ReplyToCommand(client,"Le nombre de Death DOIT etre superieur a %d", cvar_deaths_default+10);
465 return Plugin_Handled;
466 }
467 Player_Frags[target]=Frag;
468 Player_Deaths[target]=Death;
469 if(Death>0) Player_Ratio[target]=float(Frag)/float(Death);
470 }
471 }
472 else
473 {
474 ReplyToCommand(client," id : uid : Player :Ratio: Frag: Death");
475 for( new i=1; i<MaxClients; i++)
476 {
477 if(IsClientInGame(i))
478 {
479 new String:Name[MAX_NAME_LENGTH];
480 GetClientName(i, Name, sizeof(Name));
481 ReplyToCommand(client,"%4d: %4d: %25s: %5.2f, %4d, %4d", i, GetClientUserId(i), Name, Player_Ratio[i], Player_Frags[i], Player_Deaths[i]);
482 }
483 }
484 ReplyToCommand(client,"--------------------------------------------");
485 ReplyToCommand(client,"Autre Usage: sm_antiroxx <name|#userid> <frag> <death>");
486 ReplyToCommand(client,"--------------------------------------------");
487 }
488 }
489 return Plugin_Handled;
490}
491
492// --------------------------------------------------------------------------------------------------------
493//- Des que l'on ramasse quelque chose
494// --------------------------------------------------------------------------------------------------------
495public Action:Event_ItemPickup(Handle:event, const String:name[], bool:dontbroadcoast)
496{
497 if(!cvar_Active) return Plugin_Continue;
498 if(GetRealClientCount()<cvar_MinimumPly) return Plugin_Continue;
499 new userid = GetEventInt(event, "userid");
500 new String:weapon[64];
501 GetEventString(event, "item", weapon, sizeof(weapon));
502 new client = GetClientOfUserId(userid);
503 if(!IsClientInGame(client)) return Plugin_Continue;
504 new group_weapon = getGroupWeapon(weapon);
505 if(isPlayerPgm[client])
506 {
507 if(!StrEqual(weapon, "knife", false))
508 {
509 FakeClientCommand(client, "use weapon_knife");
510 new Handle:pack = CreateDataPack();
511 WritePackCell(pack, client);
512 WritePackString(pack, weapon);
513 CreateTimer(0.1, DelayWeapon, pack);
514 }
515
516 }
517 else if((Player_Ratio[client] >= cvar_snipe) && (group_weapon == GROUP_SNIPE))
518 CS_DropWeapon(client, GetPlayerWeaponSlot(client, 0), true);
519 return Plugin_Continue;
520}
521
522// --------------------------------------------------------------------------------------------------------
523//- Pas touche..
524// --------------------------------------------------------------------------------------------------------
525public Action:DelayWeapon(Handle:timer, any:data)
526{
527 new Handle:pack = data;
528 ResetPack(pack);
529 new client = ReadPackCell(pack);
530 new String:item[64];
531 ReadPackString(pack, item, sizeof(item));
532 CloseHandle(pack);
533 for( new i=0; i<2; i++)
534 {
535 new ent = GetPlayerWeaponSlot(client, i);
536 if(ent != -1)
537 {
538 RemovePlayerItem(client, ent);
539 RemoveEdict(ent);
540 }
541 }
542}
543
544// --------------------------------------------------------------------------------------------------------
545//- A la mort d'un joueur
546// --------------------------------------------------------------------------------------------------------
547public Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontbroadcoast)
548{
549 if(!cvar_Active) return Plugin_Continue;
550 if(GetRealClientCount()<cvar_MinimumPly) return Plugin_Continue;
551 new attackerID=GetEventInt(event, "attacker");
552 attackerID=GetClientOfUserId(attackerID);
553 new victimID=GetEventInt(event, "userid");
554 victimID=GetClientOfUserId(victimID);
555 new String:weapon[10];
556 GetEventString(event, "weapon", weapon, 10);
557 if((isPlayerLuciole[victimID]) && (attackerID > 0) && (!isPlayerLuciole[attackerID]))
558 {
559 if(!((StrContains(weapon, "knife", true) != -1) || (StrContains(weapon, "hegrenade", true) != -1)))
560 {
561 PrintCenterText(attackerID, "[ANTIROXX] %t", "Kill_Luciole");
562 CPrintToChat(attackerID, "{green}[ANTIROXX] {red}%t", "Kill_Luciole");
563 isPunished[attackerID] = 1;
564 }
565 }
566 if((attackerID > 0) && (IsClientInGame(attackerID)) && (!IsFakeClient(victimID)) && (!IsFakeClient(attackerID))) Player_Frags[attackerID]++;
567 if((IsClientInGame(victimID)) && (!IsFakeClient(attackerID)) && (!IsFakeClient(victimID))) Player_Deaths[victimID]++;
568 return Plugin_Continue;
569}
570// --------------------------------------------------------------------------------------------------------
571// Kill le tueur de luciolle.
572// --------------------------------------------------------------------------------------------------------
573public Action:killattaqueur(Handle:timer, any:client)
574{
575 ForcePlayerSuicide(client);
576}
577
578// --------------------------------------------------------------------------------------------------------
579// Slap du joueur en cas d'attaque de la luciole
580// --------------------------------------------------------------------------------------------------------
581public Action:Event_PlayerHurt(Handle:event,const String:name[],bool:dontBroadcast)
582{
583 if(!cvar_Active) return Plugin_Continue;
584 if(GetRealClientCount()<cvar_MinimumPly) return Plugin_Continue;
585 new attackerID = GetEventInt ( event, "attacker" ) ; // ID de l'attaquant
586 if(GetClientOfUserId(attackerID) > 0)
587 {
588 if(IsFakeClient(GetClientOfUserId(attackerID))) return Plugin_Continue;
589 new victimID = GetEventInt(event, "userid" ); // ID de la victime
590 victimID = GetClientOfUserId(victimID);
591 if(isPlayerLuciole[victimID])
592 {
593 attackerID = GetClientOfUserId (attackerID);
594 if(!isPlayerLuciole[attackerID] )
595 {
596 new String:weapon[32];
597 GetEventString(event, "weapon", weapon, sizeof(weapon)); // Arme utilisé
598 if(!((StrContains(weapon, "knife", true) != -1) || (StrContains(weapon, "hegrenade", true) != -1)))
599 {
600 new Damage=GetEventInt(event, "dmg_health");
601 if (GetClientHealth(attackerID) <= Damage) { CreateTimer(1.0, killattaqueur, attackerID); } else { SlapPlayer(attackerID, Damage); }
602 }
603 }
604 }
605 }
606 return Plugin_Continue;
607}
608
609// --------------------------------------------------------------------------------------------------------
610//- Au respawn du joueur
611// --------------------------------------------------------------------------------------------------------
612public Action:Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
613{
614 new client = GetClientOfUserId(GetEventInt(event, "userid"));
615 if(IsFakeClient(client)) return Plugin_Continue;
616 SetClanTag(client);
617 if(!cvar_Active) return Plugin_Continue;
618 SetEntProp(client, Prop_Send, "m_iAccount", START_MONEY);
619 g_hAfkCheckSpawn[client] = CreateTimer(0.2, TakeEyePosition, client);
620 if(GetRealClientCount()<cvar_MinimumPly) return Plugin_Continue;
621 new String:auth[MAX_AUTHID_LENGTH];
622 GetClientAuthString(client, auth, sizeof(auth));
623 decl String:steamid[MAX_AUTHID_LENGTH-8];
624 Format(steamid,sizeof(steamid),"%s",auth[8]);
625 if(Player_Ratio[client]<RATIO_JUNIOR)
626 {
627 SetEntityHealth(client, HP_LUCIOLE);
628 isPlayerLuciole[client]=1;
629 CreateTimer(2.0, SkinLuciole, client);
630 PrintCenterText(client, "[ANTIROXX] %t", "You_Are_Luciole");
631 CPrintToChat(client, "{green}[ANTIROXX] {olive}%t", "You_Are_Luciole");
632 }
633 else if(Player_Ratio[client]<RATIO_DEBUTANT)
634 {
635 SetEntityHealth(client, HP_JUNIOR);
636 PrintCenterText(client, "[ANTIROXX] %t", "You_Are_Junior");
637 CPrintToChat(client, "{green}[ANTIROXX] {olive}%t", "You_Are_Junior");
638 }
639 else if(Player_Ratio[client]<RATIO_PGM)
640 {
641 if( Player_Ratio[client]>=cvar_snipe )
642 {
643 new weapon = GetPlayerWeaponSlot(client, 0);
644 if(weapon != -1)
645 {
646 new String:weapon_name[64];
647 GetEdictClassname(weapon, weapon_name, 64);
648 if(getGroupWeapon(weapon_name) == GROUP_SNIPE)
649 CS_DropWeapon(client, GetPlayerWeaponSlot(client, 0), true);
650 }
651 CPrintToChat(client, "{green}[ANTIROXX] {olive}%t", "Snipe_Restrict");
652 }
653 }
654 else
655 {
656 if(gametype==GAME_CSS) { SetEntityHealth(client, HP_PGM_CSS); }
657 else if(gametype==GAME_CSGO) { SetEntityHealth(client, HP_PGM_CSGO); }
658 isPlayerPgm[client] = 1;
659 for(new i=0; i<2; i++)
660 {
661 new ent = GetPlayerWeaponSlot(client, i);
662 if(ent != -1)
663 {
664 RemovePlayerItem(client, ent);
665 RemoveEdict(ent);
666 }
667 }
668 FakeClientCommand(client, "use weapon_knife");
669 SetEntPropFloat( client, Prop_Data, "m_flLaggedMovementValue", 0.8);
670 CreateTimer(2.0, SkinPgm, client);
671 CPrintToChat(client, "{green}[ANTIROXX] {olive}%t", "You_Are_PGM");
672 }
673 if(isPunished[client])
674 {
675 isPunished[client]=0;
676 CPrintToChat(client, "{green}[ANTIROXX] {red} %t", "You_Are_Punish");
677 CreateTimer(1.0, killattaqueur, client);
678 }
679 return Plugin_Continue;
680}
681
682// --------------------------------------------------------------------------------------------------------
683//- Met en place le niveau du joueur.
684// --------------------------------------------------------------------------------------------------------
685SetClanTag(client)
686{
687 new cvar_deaths_default=GetConVarInt(gDeaths_default);
688 if(Player_Deaths[client]>(cvar_deaths_default+10))
689 {
690 if(Player_Ratio[client]<RATIO_JUNIOR) { CS_SetClientClanTag( client,"[ LUCIOLE ]"); return; }
691 if(Player_Ratio[client]<RATIO_DEBUTANT) { CS_SetClientClanTag( client,"[ JUNIOR ]"); return; }
692 if(Player_Ratio[client]<RATIO_DEBUTANT_PLUS) { CS_SetClientClanTag( client,"[DEBUTANT ]"); return; }
693 if(Player_Ratio[client]<RATIO_CONFIRME) { CS_SetClientClanTag( client,"[DEBUTANT+]"); return; }
694 if(Player_Ratio[client]<RATIO_CONFIRME_PLUS) { CS_SetClientClanTag( client,"[CONFIRME ]"); return; }
695 if(Player_Ratio[client]<RATIO_AVANCE) { CS_SetClientClanTag( client,"[CONFIRME+]"); return; }
696 if(Player_Ratio[client]<RATIO_AVANCE_PLUS) { CS_SetClientClanTag( client,"[ AVANCE ]"); return; }
697 if(Player_Ratio[client]<RATIO_PRO) { CS_SetClientClanTag( client,"[ AVANCE+ ]"); return; }
698 if(Player_Ratio[client]<RATIO_PRO_PLUS) { CS_SetClientClanTag( client,"[ PRO ]"); return; }
699 if(Player_Ratio[client]<RATIO_PGM) { CS_SetClientClanTag( client,"[ PRO+ ]"); return; }
700 CS_SetClientClanTag( client,"[ -=PGM=- ]");
701 }
702 else { CS_SetClientClanTag( client,""); }
703 return;
704}
705
706// --------------------------------------------------------------------------------------------------------
707//- Met le skin luciole après 2 seconde de jeu.
708// --------------------------------------------------------------------------------------------------------
709public Action:SkinLuciole(Handle:timer, any:client)
710{
711 if(gametype==GAME_CSS)
712 {
713 if(GetClientTeam(client)==CS_TEAM_CT) SetEntityModel(client, "models/player/tinkywinky_css/tinkywinky_css.mdl");
714 else SetEntityModel(client, "models/player/po_css/po_css.mdl");
715 }
716 if(gametype==GAME_CSGO)
717 {
718// if(GetClientTeam(client)==CS_TEAM_CT) SetEntityModel(client, "models/player/luciolle_blue/luciolle_blue.mdl");
719// else SetEntityModel(client, "models/player/luciolle_red/luciolle_red.mdl");
720
721 SetEntityRenderFx(client, RENDERFX_GLOWSHELL);
722 SetEntityRenderMode(client, RENDER_WORLDGLOW);
723 if(GetClientTeam(client)==CS_TEAM_CT) { SetEntityRenderColor(client, 100, 200, 255, 255); }
724 else { SetEntityRenderColor(client, 255, 100, 100, 255); }
725 }
726}
727
728// --------------------------------------------------------------------------------------------------------
729//- Met le skin Pgm après 2 seconde de jeu.
730// --------------------------------------------------------------------------------------------------------
731public Action:SkinPgm(Handle:timer, any:client)
732{
733 if(gametype==GAME_CSS)
734 {
735 if(GetClientTeam(client) == CS_TEAM_CT) SetEntityModel(client, "models/player/berserker_ct/berserker_ct.mdl");
736 else SetEntityModel(client, "models/player/berserker_t/berserker_t.mdl");
737 }
738}
739
740// --------------------------------------------------------------------------------------------------------
741// congeler un joueur
742// --------------------------------------------------------------------------------------------------------
743public Action:FreezePlayer(Handle:timer, any:client)
744{
745 for(new i=0; i<4; i++)
746 {
747 new ent = GetPlayerWeaponSlot(client, i);
748 if(ent != -1)
749 {
750 RemovePlayerItem(client, ent);
751 RemoveEdict(ent);
752 }
753 }
754 new Float:vec[3];
755 GetClientAbsOrigin(client, vec);
756 EmitAmbientSound("physics/glass/glass_impact_bullet4.wav", vec, client);
757 TE_SetupGlowSprite(vec, g_FreezeSprite, 0.95, 1.5, 50);
758 TE_SendToAll();
759 SetEntityMoveType(client, MOVETYPE_NONE);
760 CloseHandle(timer);
761}
762
763// --------------------------------------------------------------------------------------------------------
764//- Au debut du round
765// --------------------------------------------------------------------------------------------------------
766public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontbroadcoast)
767{
768 cvar_Active=GetConVarBool(gActive);
769 if(!cvar_Active) { return Plugin_Continue; }
770 cvar_MinimumPly=GetConVarInt(gMinimumPly);
771 if(GetRealClientCount()<cvar_MinimumPly) { return Plugin_Continue; }
772 cvar_snipe=GetConVarFloat(gRatio_snipe);
773 cvar_flash=GetConVarFloat(gRatio_flash);
774 new thereIsLuciole=0;
775 for( new i=1; i<MaxClients; i++)
776 {
777 if((IsClientInGame(i))&&(GetClientTeam(i)>CS_TEAM_SPECTATOR)&&(Player_Ratio[i]<RATIO_JUNIOR)) { thereIsLuciole=1; }
778 }
779 if(thereIsLuciole)
780 {
781 CPrintToChatAll("{green}[ANTIROXX] {olive}%t", "Luciole_InGame");
782 CreateTimer(5.0, LucioleInGame);
783 }
784 return Plugin_Continue;
785}
786
787// --------------------------------------------------------------------------------------------------------
788//- A la fin du round
789// --------------------------------------------------------------------------------------------------------
790public Action:Event_RoundEnd(Handle:event, const String:name[], bool:dontbroadcoast)
791{
792 if(!cvar_Active) return Plugin_Continue;
793 for( new client=1; client<MaxClients; client++)
794 {
795 if(IsClientInGame(client))
796 {
797 new cvar_maxcumul=GetConVarInt(gMaxCumul);
798 if(Player_Deaths[client]>=cvar_maxcumul)
799 {
800 Player_Deaths[client] /= 2;
801 Player_Frags[client] /= 2;
802 }
803 Player_Ratio[client] = float(Player_Frags[client])/float(Player_Deaths[client]);
804 isPlayerLuciole[client]=0;
805 isPlayerPgm[client]=0;
806 if(!IsFakeClient(client))
807 {
808 new String:auth[MAX_AUTHID_LENGTH];
809 GetClientAuthString(client, auth, sizeof(auth));
810 decl String:steamid[MAX_AUTHID_LENGTH-8];
811 Format(steamid,sizeof(steamid),"%s",auth[8]);
812
813 if(isConfigDownload[client])
814 {
815 decl String:pseudo[MAX_NAME_LENGTH], String:pseudo_esc[128];
816 GetClientName(client, pseudo, sizeof(pseudo));
817 SQL_EscapeString(hDatabase, pseudo, pseudo_esc, sizeof(pseudo_esc));
818
819 new String:query[150];
820 Format(query, sizeof(query), "UPDATE css_players SET pseudo='%s' ,frag='%d', death='%d' WHERE steamid='%s'", pseudo_esc, Player_Frags[client], Player_Deaths[client], steamid);
821 SQL_LockDatabase(hDatabase);
822 if(!SQL_FastQuery(hDatabase, query))
823 {
824 new String:error[255];
825 SQL_GetError(hDatabase, error, sizeof(error));
826 PrintToServer("[ANTIROXX] Failed to query (error: %s)", error);
827 LogError("[ANTIROXX] %s", query);
828 }
829 SQL_UnlockDatabase(hDatabase);
830 }
831 else { CheckSteamID(client, steamid); }
832 }
833 }
834 }
835 return Plugin_Continue;
836}
837
838// --------------------------------------------------------------------------------------------------------
839//- Au moment de l'achat
840// --------------------------------------------------------------------------------------------------------
841public Action:CS_OnBuyCommand(client, const String:weapon[])
842{
843 if((!cvar_Active) || (!IsClientInGame(client))) { return Plugin_Continue; }
844 if(GetRealClientCount()<cvar_MinimumPly) { return Plugin_Continue; }
845 new group_weapon = getGroupWeapon(weapon);
846 if(isPlayerPgm[client]) { return Plugin_Handled; }
847 if((Player_Ratio[client] >= cvar_snipe) && (group_weapon == GROUP_SNIPE)) { return Plugin_Handled; }
848 if((Player_Ratio[client] >= cvar_flash) && (group_weapon == GROUP_FLASH)) { return Plugin_Handled; }
849 else { return Plugin_Continue; }
850}
851
852// --------------------------------------------------------------------------------------------------------
853//- Recupere le type de l'arme
854// --------------------------------------------------------------------------------------------------------
855getGroupWeapon(const String:weapon[])
856{
857 if((StrContains(weapon, "awp", true) != -1) ||
858 (StrContains(weapon, "sg550", true) != -1) ||
859 (StrContains(weapon, "g3sg1", true) != -1)) { return GROUP_SNIPE; }
860 else if(StrContains(weapon, "flashbang", true) != -1) { return GROUP_FLASH; }
861 else if(StrContains(weapon, "world", true) != -1) { return GROUP_WORLD; }
862 else { return GROUP_OTHERS; }
863}
864
865// --------------------------------------------------------------------------------------------------------
866//- Une fois le client authentifié
867// --------------------------------------------------------------------------------------------------------
868public OnClientAuthorized(client)
869{
870 reset_infos(client);
871 if(IsFakeClient(client)) { return; }
872 decl String:auth[MAX_AUTHID_LENGTH];
873 GetClientAuthString(client, auth, sizeof(auth));
874 decl String:steamid[MAX_AUTHID_LENGTH-8];
875 Format(steamid,sizeof(steamid),"%s",auth[8]);
876 CheckSteamID(client, steamid);
877}
878
879// --------------------------------------------------------------------------------------------------------
880//- Reset des informations(pour être sûr)
881// --------------------------------------------------------------------------------------------------------
882reset_infos(client)
883{
884 new cvar_frags_default=GetConVarInt(gFrags_default);
885 new cvar_deaths_default=GetConVarInt(gDeaths_default);
886 Player_Frags[client]=cvar_frags_default;
887 Player_Deaths[client]=cvar_deaths_default;
888 Player_Ratio[client]=float(Player_Frags[client])/float(Player_Deaths[client]);
889 isPlayerLuciole[client]=0;
890 isPunished[client]=0;
891 isConfigDownload[client]=false;
892 TimePlayed[client] = GetTime();
893}
894
895// --------------------------------------------------------------------------------------------------------
896//- Emet de temps en temps un message d'avertissement luciole.
897// --------------------------------------------------------------------------------------------------------
898public Action:LucioleInGame(Handle:timer)
899{
900 if(GetRandomInt(1,16)>12) EmitSoundToAll("fr/rougbleu.wav");
901}
902
903// --------------------------------------------------------------------------------------------------------
904//- Prends la position des yeux.
905// --------------------------------------------------------------------------------------------------------
906public Action:TakeEyePosition(Handle:timer, any:client)
907{
908 if(g_hAfkCheckTimer[client]!=INVALID_HANDLE) KillTimer(g_hAfkCheckTimer[client]);
909 GetClientEyePosition(client, SpawnPos[client]);
910 g_hAfkCheckTimer[client]=CreateTimer(25.0, CheckForAfk, client);
911 g_hAfkCheckSpawn[client]=INVALID_HANDLE;
912}
913
914// --------------------------------------------------------------------------------------------------------
915//- Verifie la position des yeux.
916// --------------------------------------------------------------------------------------------------------
917public Action:CheckForAfk(Handle:timer, any:client)
918{
919 GetClientEyePosition(client, CurrentPos[client]);
920 if(SpawnPos[client][0] == CurrentPos[client][0] && SpawnPos[client][1] == CurrentPos[client][1] && SpawnPos[client][2] == CurrentPos[client][2])
921 {
922 decl String:name[MAX_NAME_LENGTH];
923 GetClientName(client, name, sizeof(name));
924 SlapPlayer(client, 200, false);
925 PrintToChatAll("\x04Le joueur %s a ete tue (raison:AFK) .", name);
926 }
927 g_hAfkCheckTimer[client]=INVALID_HANDLE;
928}
929
930// --------------------------------------------------------------------------------------------------------
931//- A la deconnexion du joueur
932// --------------------------------------------------------------------------------------------------------
933public OnClientDisconnect(client)
934{
935 if(!cvar_Active) return;
936 if(g_hAfkCheckTimer[client] != INVALID_HANDLE)
937 {
938 KillTimer(g_hAfkCheckTimer[client]);
939 g_hAfkCheckTimer[client] = INVALID_HANDLE;
940 }
941 new cvar_maxcumul = GetConVarInt(gMaxCumul);
942 if(Player_Deaths[client] >= cvar_maxcumul)
943 {
944 Player_Deaths[client] /= 2;
945 Player_Frags[client] /= 2;
946 }
947 Player_Ratio[client]=float(Player_Frags[client])/float(Player_Deaths[client]);
948 isPlayerLuciole[client]=0;
949 isPlayerPgm[client]=0;
950 if(!IsFakeClient(client))
951 {
952 new String:auth[MAX_AUTHID_LENGTH];
953 new String:query[150];
954 new String:ClientIP[17];
955 GetClientIP(client, ClientIP, sizeof(ClientIP));
956 GetClientAuthString(client, auth, sizeof(auth));
957 decl String:steamid[MAX_AUTHID_LENGTH-8];
958 Format(steamid,sizeof(steamid),"%s",auth[8]);
959
960 TimePlayed[client] = GetTime() - TimePlayed[client];
961
962 Format(query, sizeof(query), "UPDATE css_players SET `frag`='%d', `death`='%d', `ip`='%s', `timeplayed`=`timeplayed`+%d WHERE `steamid`='%s'", Player_Frags[client], Player_Deaths[client], ClientIP, TimePlayed[client], steamid);
963 if(isConfigDownload[client])
964 {
965 SQL_LockDatabase(hDatabase);
966 if(!SQL_FastQuery(hDatabase, query))
967 {
968 new String:error[255];
969 SQL_GetError(hDatabase, error, sizeof(error));
970 PrintToServer("[ANTIROXX] Failed to query (error: %s)", error);
971 LogError("[ANTIROXX] %s", query);
972 }
973 SQL_UnlockDatabase(hDatabase);
974 }
975 else CheckSteamID(client, steamid);
976 }
977}
978
979// --------------------------------------------------------------------------------------------------------
980//- Retourne le nombre réel de joueurs connectés.
981// --------------------------------------------------------------------------------------------------------
982GetRealClientCount()
983{
984 new clients = 0;
985 for( new i = 1; i <= MaxClients; i++ )
986 {
987 if((IsClientInGame(i)) && (!IsFakeClient(i)) && (GetClientTeam(i)>CS_TEAM_SPECTATOR) ) { clients++; }
988 }
989 return clients;
990}
991
992// --------------------------------------------------------------------------------------------------------
993//- Verification si le joueurs est autorisé a se connecter.
994// --------------------------------------------------------------------------------------------------------
995CheckKick(client)
996{
997 new cvar_deaths_default=GetConVarInt(gDeaths_default);
998 if(Player_Deaths[client]>(cvar_deaths_default+10))
999 {
1000 if(GetConVarInt(gServeur)==1 && !(plx[client]&1))
1001 {
1002 decl String:NewServer[24];
1003 decl String:KickMessage[128];
1004 GetConVarString(gNewServer,NewServer,sizeof(NewServer));
1005 Format(KickMessage, sizeof(KickMessage), "%t %s", "Too_Strong", NewServer);
1006 if(Player_Ratio[client]>=GetConVarFloat(gRatioAuth)) { KickClient(client, KickMessage); }
1007 }
1008 else if(GetConVarInt(gServeur)==2 && !(plx[client]&2))
1009 {
1010 decl String:NewServer[24];
1011 decl String:KickMessage[128];
1012 GetConVarString(gNewServer,NewServer,sizeof(NewServer));
1013 Format(KickMessage, sizeof(KickMessage), "%t %s", "Too_Low", NewServer);
1014 if(Player_Ratio[client]<=GetConVarFloat(gRatioAuth)) { KickClient(client, KickMessage); }
1015 }
1016 }
1017 return;
1018}