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