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