· 9 years ago · Dec 20, 2016, 10:03 PM
1#include <sourcemod>
2#include <sdktools>
3#include <cstrike>
4#include <sdkhooks>
5//#include <colors>
6
7#define IDAYS 26
8
9#undef REQUIRE_PLUGIN
10
11new Handle:db;
12
13#define MAX_PAINTS 800
14
15enum Listados
16{
17 String:Nombre[64],
18 index,
19 Float:wear,
20 stattrak,
21 quality,
22 pattern,
23 String:flag[8]
24}
25
26new Handle:menuw = INVALID_HANDLE;
27new g_paints[MAX_PAINTS][Listados];
28new g_paintCount = 0;
29new String:path_paints[PLATFORM_MAX_PATH];
30
31new bool:g_hosties = false;
32
33new bool:g_c4;
34new Handle:cvar_c4;
35
36new Handle:arbol[MAXPLAYERS+1] = INVALID_HANDLE;
37new Handle:menu1[MAXPLAYERS+1] = INVALID_HANDLE;
38
39new Handle:saytimer;
40new Handle:cvar_saytimer;
41new g_saytimer;
42
43new Handle:rtimer;
44new Handle:cvar_rtimer;
45new g_rtimer;
46
47new Handle:cvar_rmenu;
48new bool:g_rmenu;
49
50new Handle:cvar_onlyadmin;
51new bool:onlyadmin;
52
53new Handle:cvar_zombiesv;
54new bool:zombiesv;
55
56new String:s_arma[MAXPLAYERS+1][64];
57new s_sele[MAXPLAYERS+1];
58
59new ismysql;
60
61new Handle:array_paints;
62new Handle:array_armas;
63
64#define DATA "2.8.4 public version"
65
66//new String:base[64] = "weaponpaints";
67
68new bool:uselocal = false;
69
70new bool:comprobado41[MAXPLAYERS+1];
71
72
73public Plugin:myinfo =
74{
75 name = "WS Wizard Gaming",
76 author = "Franc1sco franug",
77 description = "",
78 version = DATA,
79 url = "http://steamcommunity.com/id/franug"
80};
81
82new String:g_sCmdLogPath[256];
83
84
85public Action Rtimer(Handle:timer)
86{
87 rtimer = INVALID_HANDLE;
88}
89
90
91public tbasico(Handle:owner, Handle:hndl, const String:error[], any:data)
92{
93 if (hndl == INVALID_HANDLE)
94 {
95 LogToFileEx(g_sCmdLogPath, "Query failure: %s", error);
96 }
97 new client;
98
99 /* Make sure the client didn't disconnect while the thread was running */
100 if ((client = GetClientOfUserId(data)) == 0)
101 {
102 return;
103 }
104 comprobado41[client] = true;
105
106}
107
108public tbasico2(Handle:owner, Handle:hndl, const String:error[], any:data)
109{
110 if (hndl == INVALID_HANDLE)
111 {
112 LogToFileEx(g_sCmdLogPath, "Query failure: %s", error);
113 ComprobarDB();
114 }
115}
116
117public tbasico3(Handle:owner, Handle:hndl, const String:error[], any:data)
118{
119 if (hndl == INVALID_HANDLE)
120 {
121 LogToFileEx(g_sCmdLogPath, "Query failure: %s", error);
122 ComprobarDB();
123 }
124 new client;
125
126 /* Make sure the client didn't disconnect while the thread was running */
127 if ((client = GetClientOfUserId(data)) == 0)
128 {
129 return;
130 }
131
132 arbol[client] = CreateTrie();
133
134 new String:Items[64];
135
136 for(new i=0;i<GetArraySize(array_armas);++i)
137 {
138 GetArrayString(array_armas, i, Items, 64);
139 SetTrieValue(arbol[client], Items, -1);
140 }
141
142 SetTrieValue(arbol[client], "favorite1", -1);
143 SetTrieValue(arbol[client], "favorite2", -1);
144 SetTrieValue(arbol[client], "favorite3", -1);
145 SetTrieValue(arbol[client], "favorite4", -1);
146 SetTrieValue(arbol[client], "favorite5", -1);
147 SetTrieValue(arbol[client], "favorite6", -1);
148 SetTrieValue(arbol[client], "favorite7", -1);
149
150 comprobado41[client] = true;
151}
152
153Nuevo(client)
154{
155 //PrintToChatAll("metido");
156 decl String:query[255], String:steamid[32];
157 GetClientAuthId(client, AuthId_Steam2, steamid, sizeof(steamid) );
158 new userid = GetClientUserId(client);
159
160 new String:Name[MAX_NAME_LENGTH+1];
161 new String:SafeName[(sizeof(Name)*2)+1];
162 if (!GetClientName(client, Name, sizeof(Name)))
163 Format(SafeName, sizeof(SafeName), "<noname>");
164 else
165 {
166 TrimString(Name);
167 SQL_EscapeString(db, Name, SafeName, sizeof(SafeName));
168 }
169
170 Format(query, sizeof(query), "INSERT INTO weaponpaints(playername, steamid, last_accountuse) VALUES('%s', '%s', '%d');", SafeName, steamid, GetTime());
171 LogToFileEx(g_sCmdLogPath, "Query %s", query);
172 SQL_TQuery(db, tbasico3, query, userid);
173}
174
175public T_CheckSteamID(Handle:owner, Handle:hndl, const String:error[], any:data)
176{
177 new client;
178
179 /* Make sure the client didn't disconnect while the thread was running */
180 if ((client = GetClientOfUserId(data)) == 0)
181 {
182 return;
183 }
184 if (hndl == INVALID_HANDLE)
185 {
186 ComprobarDB();
187 return;
188 }
189 //PrintToChatAll("comprobado41");
190 if (!SQL_GetRowCount(hndl) || !SQL_FetchRow(hndl))
191 {
192 Nuevo(client);
193 return;
194 }
195
196 arbol[client] = CreateTrie();
197
198 new String:Items[64];
199
200 new String:temp[64];
201 new contar = 3;
202 for(new i=0;i<GetArraySize(array_armas);++i)
203 {
204 GetArrayString(array_armas, i, Items, 64);
205 SQL_FetchString(hndl, contar, temp, 64);
206 SetTrieValue(arbol[client], Items, FindStringInArray(array_paints, temp));
207
208 //LogMessage("Sacado %i del arma %s", FindStringInArray(array_paints, temp),Items);
209
210 contar++;
211 }
212
213/* SQL_FetchString(hndl, contar, temp, 64);
214 SetTrieValue(arbol[client], "favorite1", FindStringInArray(array_paints, temp));
215 contar++;
216
217 SQL_FetchString(hndl, contar, temp, 64);
218 SetTrieValue(arbol[client], "favorite2", FindStringInArray(array_paints, temp));
219 contar++;
220
221 SQL_FetchString(hndl, contar, temp, 64);
222 SetTrieValue(arbol[client], "favorite3", FindStringInArray(array_paints, temp));
223 contar++;
224
225 SQL_FetchString(hndl, contar, temp, 64);
226 SetTrieValue(arbol[client], "favorite4", FindStringInArray(array_paints, temp));
227 contar++;
228
229 SQL_FetchString(hndl, contar, temp, 64);
230 SetTrieValue(arbol[client], "favorite5", FindStringInArray(array_paints, temp));
231 contar++;
232
233 SQL_FetchString(hndl, contar, temp, 64);
234 SetTrieValue(arbol[client], "favorite6", FindStringInArray(array_paints, temp));
235 contar++;
236
237 SQL_FetchString(hndl, contar, temp, 64);
238 SetTrieValue(arbol[client], "favorite7", FindStringInArray(array_paints, temp));
239 contar++; */
240
241
242 comprobado41[client] = true;
243/* new String:equipo[64];
244 SQL_FetchString( hndl, 0, equipo, 64);
245 PrintToChatAll(equipo);
246
247 SQL_FetchString( hndl, 1, equipo, 64);
248 PrintToChatAll(equipo);
249
250 SQL_FetchString( hndl, 2, equipo, 64);
251 PrintToChatAll(equipo);
252
253 SQL_FetchString( hndl, 3, equipo, 64); // este
254 PrintToChatAll(equipo); */
255
256 //PrintToChatAll("pasado");
257
258/* new String:equipo[4];
259 SQL_FetchString( hndl, 0, equipo, 4);
260
261 if(StrEqual(equipo, "CT", false))
262 {
263 ft[client] = CS_TEAM_CT;
264 }
265 else if(StrEqual(equipo, "T", false))
266 {
267 ft[client] = CS_TEAM_T;
268 } */
269}
270
271CheckSteamID(client)
272{
273 decl String:query[255], String:steamid[32];
274 GetClientAuthId(client, AuthId_Steam2, steamid, sizeof(steamid) );
275
276 Format(query, sizeof(query), "SELECT * FROM weaponpaints WHERE steamid = '%s'", steamid);
277 LogToFileEx(g_sCmdLogPath, "Query %s", query);
278 SQL_TQuery(db, T_CheckSteamID, query, GetClientUserId(client));
279}
280
281public OnClientPostAdminCheck(client)
282{
283 if(!IsFakeClient(client)) CheckSteamID(client);
284 //PrintToChatAll("algo");
285}
286
287public tbasicoC(Handle:owner, Handle:hndl, const String:error[], any:data)
288{
289 if (hndl == INVALID_HANDLE)
290 {
291 LogToFileEx(g_sCmdLogPath, "Query failure: %s", error);
292 }
293 //LogMessage("Database connection successful");
294
295 for(new client = 1; client <= MaxClients; client++)
296 {
297 if(IsClientInGame(client))
298 {
299 OnClientPostAdminCheck(client);
300 }
301 }
302}
303
304public tbasicoP(Handle:owner, Handle:hndl, const String:error[], any:data)
305{
306 if (hndl == INVALID_HANDLE)
307 {
308 LogToFileEx(g_sCmdLogPath, "Query failure: %s", error);
309 ComprobarDB();
310 }
311 //LogMessage("Prune Database successful");
312}
313
314public roundStart(Handle:event, const String:name[], bool:dontBroadcast)
315{
316 if(g_rtimer == -1) return;
317
318 if(rtimer != INVALID_HANDLE)
319 {
320 KillTimer(rtimer);
321 rtimer = INVALID_HANDLE;
322 }
323
324 rtimer = CreateTimer(1.0*g_rtimer, Rtimer);
325}
326
327public OnConVarChanged(Handle:convar, const String:oldValue[], const String:newValue[])
328{
329 if (convar == cvar_c4)
330 {
331 g_c4 = bool:StringToInt(newValue);
332 }
333 else if (convar == cvar_saytimer)
334 {
335 g_saytimer = StringToInt(newValue);
336 }
337 else if (convar == cvar_rtimer)
338 {
339 g_rtimer = StringToInt(newValue);
340 }
341 else if (convar == cvar_rmenu)
342 {
343 g_rmenu = bool:StringToInt(newValue);
344 }
345 else if (convar == cvar_onlyadmin)
346 {
347 onlyadmin = bool:StringToInt(newValue);
348 }
349 else if (convar == cvar_zombiesv)
350 {
351 zombiesv = bool:StringToInt(newValue);
352 }
353}
354
355ComprobarDB(bool:reconnect = false,String:basedatos[64] = "weaponpaints")
356{
357 if(uselocal) basedatos = "clientprefs";
358 if(reconnect)
359 {
360 if (db != INVALID_HANDLE)
361 {
362 //LogMessage("Reconnecting DB connection");
363 CloseHandle(db);
364 db = INVALID_HANDLE;
365 }
366 }
367 else if (db != INVALID_HANDLE)
368 {
369 return;
370 }
371
372 if (!SQL_CheckConfig( basedatos ))
373 {
374 if(StrEqual(basedatos, "clientprefs")) SetFailState("Databases not found");
375 else
376 {
377 //base = "clientprefs";
378 ComprobarDB(true,"clientprefs");
379 uselocal = true;
380 }
381
382 return;
383 }
384 SQL_TConnect(OnSqlConnect, basedatos);
385}
386
387public OnSqlConnect(Handle:owner, Handle:hndl, const String:error[], any:data)
388{
389 if (hndl == INVALID_HANDLE)
390 {
391 LogToFileEx(g_sCmdLogPath, "Database failure: %s", error);
392
393 SetFailState("Databases dont work");
394 }
395 else
396 {
397 db = hndl;
398 decl String:buffer[3096];
399
400 SQL_GetDriverIdent(SQL_ReadDriver(db), buffer, sizeof(buffer));
401 ismysql = StrEqual(buffer,"mysql", false) ? 1 : 0;
402
403 new String:temp[64][44];
404 for(new i=0;i<GetArraySize(array_armas);++i)
405 {
406 GetArrayString(array_armas, i, temp[i], 64);
407 }
408 if (ismysql == 1)
409 {
410 Format(buffer, sizeof(buffer), "CREATE TABLE IF NOT EXISTS `weaponpaints` (`playername` varchar(128) NOT NULL, `steamid` varchar(32) NOT NULL, `last_accountuse` int(64) NOT NULL, `%s` varchar(64) NOT NULL DEFAULT 'none', `%s` varchar(64) NOT NULL DEFAULT 'none', `%s` varchar(64) NOT NULL DEFAULT 'none', `%s` varchar(64) NOT NULL DEFAULT 'none', `%s` varchar(64) NOT NULL DEFAULT 'none', `%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`%s` varchar(64) NOT NULL DEFAULT 'none',`favorite1` varchar(64) NOT NULL DEFAULT 'none',`favorite2` varchar(64) NOT NULL DEFAULT 'none',`favorite3` varchar(64) NOT NULL DEFAULT 'none',`favorite4` varchar(64) NOT NULL DEFAULT 'none',`favorite5` varchar(64) NOT NULL DEFAULT 'none',`favorite6` varchar(64) NOT NULL DEFAULT 'none',`favorite7` varchar(64) NOT NULL DEFAULT 'none',PRIMARY KEY (`steamid`))",temp[0],temp[1],temp[2],temp[3],temp[4],temp[5],temp[6],temp[7],temp[8],temp[9],temp[10],temp[11],temp[12],temp[13],temp[14],temp[15],temp[16],temp[17],temp[18],temp[19],temp[20],temp[21],temp[22],temp[23],temp[24],temp[25],temp[26],temp[27],temp[28],temp[29],temp[30],temp[31],temp[32],temp[33],temp[34],temp[35],temp[36],temp[37],temp[38],temp[39],temp[40], temp[41], temp[42], temp[43]);
411
412 LogToFileEx(g_sCmdLogPath, "Query %s", buffer);
413 SQL_TQuery(db, tbasicoC, buffer);
414
415 }
416 else
417 {
418 Format(buffer, sizeof(buffer), "CREATE TABLE IF NOT EXISTS weaponpaints (playername varchar(128) NOT NULL, steamid varchar(32) NOT NULL, last_accountuse int(64) NOT NULL, %s varchar(64) NOT NULL DEFAULT 'none', %s varchar(64) NOT NULL DEFAULT 'none', %s varchar(64) NOT NULL DEFAULT 'none', %s varchar(64) NOT NULL DEFAULT 'none', %s varchar(64) NOT NULL DEFAULT 'none', %s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',%s varchar(64) NOT NULL DEFAULT 'none',favorite1 varchar(64) NOT NULL DEFAULT 'none',favorite2 varchar(64) NOT NULL DEFAULT 'none',favorite3 varchar(64) NOT NULL DEFAULT 'none',favorite4 varchar(64) NOT NULL DEFAULT 'none',favorite5 varchar(64) NOT NULL DEFAULT 'none',favorite6 varchar(64) NOT NULL DEFAULT 'none',favorite7 varchar(64) NOT NULL DEFAULT 'none',PRIMARY KEY (steamid))",temp[0],temp[1],temp[2],temp[3],temp[4],temp[5],temp[6],temp[7],temp[8],temp[9],temp[10],temp[11],temp[12],temp[13],temp[14],temp[15],temp[16],temp[17],temp[18],temp[19],temp[20],temp[21],temp[22],temp[23],temp[24],temp[25],temp[26],temp[27],temp[28],temp[29],temp[30],temp[31],temp[32],temp[33],temp[34],temp[35],temp[36],temp[37],temp[38],temp[39],temp[40],temp[41], temp[42], temp[43]);
419
420 LogToFileEx(g_sCmdLogPath, "Query %s", buffer);
421 SQL_TQuery(db, tbasicoC, buffer);
422 }
423 }
424}
425
426SaveCookies(client)
427{
428 decl String:steamid[32];
429 GetClientAuthId(client, AuthId_Steam2, steamid, sizeof(steamid) );
430 new String:Name[MAX_NAME_LENGTH+1];
431 new String:SafeName[(sizeof(Name)*2)+1];
432 if (!GetClientName(client, Name, sizeof(Name)))
433 Format(SafeName, sizeof(SafeName), "<noname>");
434 else
435 {
436 TrimString(Name);
437 SQL_EscapeString(db, Name, SafeName, sizeof(SafeName));
438 }
439
440 decl String:buffer[3096];
441 Format(buffer, sizeof(buffer), "UPDATE weaponpaints SET last_accountuse = %d, playername = '%s' WHERE steamid = '%s';",GetTime(), SafeName,steamid);
442 LogToFileEx(g_sCmdLogPath, "Query %s", buffer);
443 SQL_TQuery(db, tbasico2, buffer);
444}
445
446public OnClientDisconnect(client)
447{
448 if(comprobado41[client] && !IsFakeClient(client)) SaveCookies(client);
449 comprobado41[client] = false;
450 if(arbol[client] != INVALID_HANDLE)
451 {
452 ClearTrie(arbol[client]);
453 CloseHandle(arbol[client]);
454 arbol[client] = INVALID_HANDLE;
455 }
456 if(menu1[client] != INVALID_HANDLE)
457 {
458 CloseHandle(menu1[client]);
459 menu1[client] = INVALID_HANDLE;
460 }
461}
462
463public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
464{
465}
466
467public OnLibraryAdded(const String:name[])
468{
469 if (StrEqual(name, "hosties"))
470 {
471 g_hosties = true;
472 }
473}
474
475public OnLibraryRemoved(const String:name[])
476{
477 if (StrEqual(name, "hosties"))
478 {
479 g_hosties = false;
480 }
481}
482
483public Action ReloadSkins(client, args)
484{
485 ReadPaints();
486 ReplyToCommand(client, " \x04[WP]\x01 %T","Weapon paints reloaded", client);
487
488 return Plugin_Handled;
489}
490
491ShowMenu(client, item)
492{
493 SetMenuTitle(menuw, "%T","Menu title 1", client);
494
495 //RemoveMenuItem(menuw, 2);
496 RemoveMenuItem(menuw, 1);
497 RemoveMenuItem(menuw, 0);
498 decl String:tdisplay[64];
499 //Format(tdisplay, sizeof(tdisplay), "%T", "Escolhe as tuas skins favoritas!", client);
500 //InsertMenuItem(menuw, 0, "-2", tdisplay);
501 Format(tdisplay, sizeof(tdisplay), "%T", "Random skin", client);
502 InsertMenuItem(menuw, 0, "0", tdisplay);
503 Format(tdisplay, sizeof(tdisplay), "%T", "Sem skin", client);
504 InsertMenuItem(menuw, 1, "-1", tdisplay);
505
506 DisplayMenuAtItem(menuw, client, item, 0);
507}
508
509ShowMenuM(client)
510{
511 if(onlyadmin && GetUserAdmin(client) == INVALID_ADMIN_ID) return;
512
513 new Handle:menu2 = CreateMenu(DIDMenuHandler_2);
514 SetMenuTitle(menu2, "!ws - Wizard Gaming","Menu title 2", client, DATA);
515
516 decl String:tdisplay[64];
517 Format(tdisplay, sizeof(tdisplay), "%T", "Escolhe a skin para a arma que tens na mao", client);
518 AddMenuItem(menu2, "1", tdisplay);
519 Format(tdisplay, sizeof(tdisplay), "%T", "Escolhe a skin para cada arma", client);
520 AddMenuItem(menu2, "2", tdisplay);
521 //Format(tdisplay, sizeof(tdisplay), "%T", "Skins favoritas", client);
522 //AddMenuItem(menu2, "3", tdisplay);
523
524 DisplayMenu(menu2, client, 0);
525}
526
527public Action GetSkins(client, args)
528{
529 Format(s_arma[client], 64, "none");
530 ShowMenuM(client);
531
532 return Plugin_Handled;
533}
534
535public Action OnClientSayCommand(client, const String:command[], const String:sArgs[])
536{
537 if(StrEqual(sArgs, "!wskins", false) || StrEqual(sArgs, "!ws", false) || StrEqual(sArgs, "!paints", false))
538 {
539 Format(s_arma[client], 64, "none");
540 //ShowMenuM(client);
541
542 if(saytimer != INVALID_HANDLE || g_saytimer == -1) return Plugin_Handled;
543 saytimer = CreateTimer(1.0*g_saytimer, Tsaytimer);
544 return Plugin_Continue;
545
546 }
547 else if(StrEqual(sArgs, "!ss", false) || StrEqual(sArgs, "!showskin", false))
548 {
549 ShowSkin(client);
550
551 if(saytimer != INVALID_HANDLE || g_saytimer == -1) return Plugin_Handled;
552 saytimer = CreateTimer(1.0*g_saytimer, Tsaytimer);
553 return Plugin_Continue;
554 }
555
556 return Plugin_Continue;
557}
558
559ShowSkin(client)
560{
561 new weapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
562 if(weapon < 1 || !IsValidEdict(weapon) || !IsValidEntity(weapon))
563 {
564 PrintToChat(client, " {green}[{blue}WizardGaming{green}]{default} %T", "Pintura nao encontrada", client);
565 return;
566 }
567
568 new buscar = GetEntProp(weapon,Prop_Send,"m_nFallbackPaintKit");
569 for(new i=1; i<g_paintCount;i++)
570 {
571 if(buscar == g_paints[i][index])
572 {
573 PrintToChat(client, " {green}[{blue}WizardGaming{green}]{default} %T", "Skin encontrada", client, g_paints[i][Nombre]);
574 return;
575 }
576 }
577
578 PrintToChat(client, " {green}[{blue}WizardGaming{green}]{default} %T", "Skin nao encontrada", client);
579}
580
581public Action Tsaytimer(Handle:timer, Handle:pack)
582{
583 saytimer = INVALID_HANDLE;
584}
585
586public DIDMenuHandler_2(Handle:menu, MenuAction:action, client, itemNum)
587{
588 if ( action == MenuAction_Select )
589 {
590
591
592 decl String:info[4];
593
594 GetMenuItem(menu, itemNum, info, sizeof(info));
595 new theindex = StringToInt(info);
596 if(theindex == 1) ShowMenu(client, 0);
597 else if(theindex == 2 && comprobado41[client]) ShowMenuArmas(client, 0);
598 //else if(theindex == 3) ShowMenuFav(client);
599 }
600 else if (action == MenuAction_End)
601 {
602 CloseHandle(menu);
603 }
604}
605
606ShowMenuArmas(client, item)
607{
608 if(menu1[client] == INVALID_HANDLE) CrearMenu1(client);
609 DisplayMenuAtItem(menu1[client], client, item, 0);
610}
611
612public DIDMenuHandler(Handle:menu, MenuAction:action, client, itemNum)
613{
614 if ( action == MenuAction_Select )
615 {
616 if(!comprobado41[client])
617 {
618 if(g_rmenu) ShowMenu(client, GetMenuSelectionPosition());
619 return;
620 }
621
622 decl String:Classname[64];
623 decl String:info[4];
624
625 GetMenuItem(menu, itemNum, info, sizeof(info));
626 new theindex = StringToInt(info);
627
628 if(StrEqual(s_arma[client], "none"))
629 {
630 if(GetUserAdmin(client) == INVALID_ADMIN_ID && rtimer == INVALID_HANDLE && g_rtimer != -1)
631 {
632 PrintToChat(client, " {green}[{blue}WizardGaming{green}]{default} %T", "You can use this command only the first seconds", client, g_rtimer);
633 if(g_rmenu) ShowMenu(client, GetMenuSelectionPosition());
634 return;
635 }
636 if(!IsPlayerAlive(client))
637 {
638 PrintToChat(client, " {green}[{blue}WizardGaming{green}]{default} %T", "You cant use this when you are dead", client);
639 if(g_rmenu) ShowMenu(client, GetMenuSelectionPosition());
640 return;
641 }
642
643 if(theindex != -1 && !StrEqual(g_paints[theindex][flag], "0"))
644 {
645 if(!CheckCommandAccess(client, "weaponpaints_override", ReadFlagString(g_paints[theindex][flag]), true))
646 {
647 PrintToChat(client, " {green}[{blue}WizardGaming{green}]{default} %T", "You dont have access to this paint", client);
648 if(g_rmenu) ShowMenu(client, GetMenuSelectionPosition());
649 return;
650 }
651 }
652
653
654 new windex = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
655 if(windex < 1)
656 {
657 PrintToChat(client, " {green}[{blue}WizardGaming{green}]{default} %T", "Nao podes usar uma skin neste item", client);
658 if(g_rmenu) ShowMenu(client, GetMenuSelectionPosition());
659 return;
660 }
661
662
663 if(!GetEdictClassname(windex, Classname, 64) || StrEqual(Classname, "weapon_taser") || (!g_c4 && StrEqual(Classname, "weapon_c4")))
664 {
665 PrintToChat(client, " {green}[{blue}WizardGaming{green}]{default} %T", "Nao podes usar uma skin neste item", client);
666 if(g_rmenu) ShowMenu(client, GetMenuSelectionPosition());
667 return;
668 }
669 ReplaceString(Classname, 64, "weapon_", "");
670 new weaponindex = GetEntProp(windex, Prop_Send, "m_iItemDefinitionIndex");
671 if(weaponindex == 42 || weaponindex == 59)
672 {
673 PrintToChat(client, " {green}[{blue}WizardGaming{green}]{default} %T", "Nao podes usar uma skin neste item", client);
674 if(g_rmenu) ShowMenu(client, GetMenuSelectionPosition());
675 return;
676 }
677 if(GetPlayerWeaponSlot(client, CS_SLOT_PRIMARY) == windex || GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY) == windex || GetPlayerWeaponSlot(client, CS_SLOT_KNIFE) == windex || (g_c4 && GetPlayerWeaponSlot(client, CS_SLOT_C4) == windex))
678 {
679 switch (weaponindex)
680 {
681 case 60: strcopy(Classname, 64, "m4a1_silencer");
682 case 61: strcopy(Classname, 64, "usp_silencer");
683 case 63: strcopy(Classname, 64, "cz75a");
684 case 500: strcopy(Classname, 64, "bayonet");
685 case 506: strcopy(Classname, 64, "knife_gut");
686 case 505: strcopy(Classname, 64, "knife_flip");
687 case 508: strcopy(Classname, 64, "knife_m9_bayonet");
688 case 507: strcopy(Classname, 64, "knife_karambit");
689 case 509: strcopy(Classname, 64, "knife_tactical");
690 case 515: strcopy(Classname, 64, "knife_butterfly");
691 case 512: strcopy(Classname, 64, "knife_falchion");
692 case 516: strcopy(Classname, 64, "knife_push");
693 case 64: strcopy(Classname, 64, "revolver");
694 case 514: strcopy(Classname, 64, "knife_survival_bowie");
695 }
696
697 if(arbol[client] == INVALID_HANDLE)
698 {
699 OnClientPostAdminCheck(client);
700 return;
701 }
702 else
703 {
704 new valor = 0;
705 if(!GetTrieValue(arbol[client], Classname, valor))
706 {
707 PrintToChat(client, " {green}[{blue}WizardGaming{green}]{default} %T", "Nao podes usar uma skin neste item", client);
708 if(g_rmenu) ShowMenu(client, GetMenuSelectionPosition());
709 return;
710 }
711
712 decl String:buffer[1024], String:nombres[64];
713 if(theindex == -1) Format(nombres, sizeof(nombres), "default");
714 else Format(nombres, sizeof(nombres), g_paints[theindex][Nombre]);
715 decl String:steamid[32];
716 GetClientAuthId(client, AuthId_Steam2, steamid, sizeof(steamid) );
717 Format(buffer, sizeof(buffer), "UPDATE weaponpaints SET %s = '%s' WHERE steamid = '%s';", Classname,nombres,steamid);
718 LogToFileEx(g_sCmdLogPath, "Query %s", buffer);
719 SQL_TQuery(db, tbasico, buffer, GetClientUserId(client));
720 SetTrieValue(arbol[client], Classname, theindex);
721 }
722
723 //ChangePaint(client, windex, Classname, weaponindex, true);
724 decl String:Classname2[64];
725 Format(Classname2, 64, "weapon_%s", Classname);
726 Restore(client, windex, Classname2, weaponindex);
727 FakeClientCommand(client, "use %s", Classname2);
728 if(theindex == -1) PrintToChat(client, " {green}[{blue}WizardGaming{green}]{default} %T","Escolheste a skin original para a tua",client, Classname);
729 else if(theindex == 0) PrintToChat(client, " {green}[{blue}WizardGaming{green}]{default} %T","Escolheste uma skin random para a tua",client, Classname);
730 else PrintToChat(client, " {green}[{blue}WizardGaming{green}]{default} %T", "Escolheste uma arma",client, g_paints[theindex][Nombre], Classname);
731
732 decl String:temp[128], String:temp1[64];
733 if(theindex == -1) Format(temp, 128, "%s", Classname);
734 else if (theindex == 0)
735 {
736
737 Format(temp1, sizeof(temp1), "%T", "Random paint", client);
738 Format(temp, 128, "%s - %s", Classname, temp1);
739 }
740 else Format(temp, 128, "%s - %s", Classname, g_paints[theindex][Nombre]);
741 if(menu1[client] == INVALID_HANDLE) CrearMenu1(client);
742 new imenu = FindStringInArray(array_armas, Classname);
743 InsertMenuItem(menu1[client], imenu, Classname, temp);
744 FindStringInArray(array_armas, Classname);
745 RemoveMenuItem(menu1[client], imenu+1);
746 }
747 else PrintToChat(client, " {green}[{blue}WizardGaming{green}]{default} %T", "Nao podes usar uma skin neste item",client);
748
749
750 }
751 else
752 {
753 Format(Classname, 64, s_arma[client]);
754
755 if(arbol[client] == INVALID_HANDLE)
756 {
757 OnClientPostAdminCheck(client);
758 return;
759 }
760 else
761 {
762 decl String:buffer[1024], String:nombres[64];
763 if(theindex == -1) Format(nombres, sizeof(nombres), "default");
764 else Format(nombres, sizeof(nombres), g_paints[theindex][Nombre]);
765 decl String:steamid[32];
766 GetClientAuthId(client, AuthId_Steam2, steamid, sizeof(steamid) );
767 Format(buffer, sizeof(buffer), "UPDATE weaponpaints SET %s = '%s' WHERE steamid = '%s';", Classname,nombres,steamid);
768 LogToFileEx(g_sCmdLogPath, "Query %s", buffer);
769 SQL_TQuery(db, tbasico, buffer, GetClientUserId(client));
770 SetTrieValue(arbol[client], Classname, theindex);
771 }
772
773 if(theindex == -1) PrintToChat(client, " {green}[{blue}WizardGaming{green}]{default} %T","Escolheste a skin original para a tua",client, Classname);
774 else if(theindex == 0) PrintToChat(client, " {green}[{blue}WizardGaming{green}]{default} %T","Escolheste uma skin random para a tua",client, Classname);
775 else PrintToChat(client, " {green}[{blue}WizardGaming{green}]{default} %T", "Escolheste uma arma",client, g_paints[theindex][Nombre], Classname);
776
777 decl String:temp[128], String:temp1[64];
778 if(theindex == -1) Format(temp, 128, "%s", Classname);
779 else if (theindex == 0)
780 {
781
782 Format(temp1, sizeof(temp1), "%T", "Random paint", client);
783 Format(temp, 128, "%s - %s", Classname, temp1);
784 }
785 else Format(temp, 128, "%s - %s", Classname, g_paints[theindex][Nombre]);
786 new imenu = FindStringInArray(array_armas, Classname);
787 InsertMenuItem(menu1[client], imenu, Classname, temp);
788 FindStringInArray(array_armas, Classname);
789 RemoveMenuItem(menu1[client], imenu+1);
790 Format(s_arma[client], 64, "none");
791 ShowMenuArmas(client, s_sele[client]);
792 return;
793 }
794
795 if(g_rmenu) ShowMenu(client, GetMenuSelectionPosition());
796
797 }
798}
799
800/* public RestoreItemID(Handle:timer, Handle:pack)
801{
802 new entity;
803 new m_iItemIDHigh;
804 new m_iItemIDLow;
805
806 ResetPack(pack);
807 entity = EntRefToEntIndex(ReadPackCell(pack));
808 m_iItemIDHigh = ReadPackCell(pack);
809 m_iItemIDLow = ReadPackCell(pack);
810
811 if(entity != INVALID_ENT_REFERENCE)
812 {
813 SetEntProp(entity,Prop_Send,"m_iItemIDHigh",m_iItemIDHigh);
814 SetEntProp(entity,Prop_Send,"m_iItemIDLow",m_iItemIDLow);
815 }
816} */
817
818ReadPaints()
819{
820 BuildPath(Path_SM, path_paints, sizeof(path_paints), "configs/csgo_wpaints.cfg");
821
822 decl Handle:kv;
823 g_paintCount = 1;
824 ClearArray(array_paints);
825 PushArrayString(array_paints, "random");
826 Format(g_paints[0][Nombre], 64, "random")
827
828 kv = CreateKeyValues("Paints");
829 FileToKeyValues(kv, path_paints);
830
831 if (!KvGotoFirstSubKey(kv)) {
832
833 SetFailState("CFG File not found: %s", path_paints);
834 CloseHandle(kv);
835 }
836 do {
837
838 KvGetSectionName(kv, g_paints[g_paintCount][Nombre], 64);
839 g_paints[g_paintCount][index] = KvGetNum(kv, "paint", 0);
840 g_paints[g_paintCount][wear] = KvGetFloat(kv, "wear", 0.01);
841 g_paints[g_paintCount][stattrak] = KvGetNum(kv, "stattrak", -2);
842 g_paints[g_paintCount][quality] = KvGetNum(kv, "quality", 3);
843 g_paints[g_paintCount][pattern] = KvGetNum(kv, "pattern", 0);
844 KvGetString(kv, "flag", g_paints[g_paintCount][flag], 8, "0");
845
846 PushArrayString(array_paints, g_paints[g_paintCount][Nombre]);
847 g_paintCount++;
848 } while (KvGotoNextKey(kv));
849 CloseHandle(kv);
850
851 if(menuw != INVALID_HANDLE) CloseHandle(menuw);
852 menuw = INVALID_HANDLE;
853
854 menuw = CreateMenu(DIDMenuHandler);
855
856 // TROLLING
857 SetMenuTitle(menuw, "( ?° ?? ?°)");
858 decl String:item[4];
859 AddMenuItem(menuw, "0", "Random paint");
860 AddMenuItem(menuw, "-1", "Default paint");
861 // FORGET THIS
862
863 for (new i=g_paintCount; i<MAX_PAINTS; ++i) {
864
865 g_paints[i][index] = 0;
866 }
867 //decl String:menuitem[192];
868 for (new i=1; i<g_paintCount; ++i) {
869 Format(item, 4, "%i", i);
870 AddMenuItem(menuw, item, g_paints[i][Nombre]);
871
872/* if(StrEqual(g_paints[g_paintCount][flag], "public", false))
873 {
874 AddMenuItem(menuw, item, g_paints[i][Nombre]);
875 }
876 else
877 {
878 Format(menuitem, 192, "%s (flag %s)", g_paints[i][Nombre],g_paints[i][flag]);
879 AddMenuItem(menuw, item, menuitem);
880 } */
881 }
882 SetMenuExitButton(menuw, true);
883}
884
885/* stock GetReserveAmmo(client, weapon)
886{
887 new ammotype = GetEntProp(weapon, Prop_Send, "m_iPrimaryAmmoType");
888 if(ammotype == -1) return -1;
889
890 return GetEntProp(client, Prop_Send, "m_iAmmo", _, ammotype);
891}
892
893stock SetReserveAmmo(client, weapon, ammo)
894{
895 new ammotype = GetEntProp(weapon, Prop_Send, "m_iPrimaryAmmoType");
896 if(ammotype == -1) return;
897
898 SetEntProp(client, Prop_Send, "m_iAmmo", ammo, _, ammotype);
899} */
900
901stock GetReserveAmmo(weapon)
902{
903 new ammotype = GetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount");
904 if(ammotype == -1) return -1;
905
906 return ammotype;
907}
908
909stock SetReserveAmmo(weapon, ammo)
910{
911 SetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", ammo);
912 //PrintToChatAll("fijar es %i", ammo);
913}
914
915Restore(client, windex, String:Classname[64], weaponindex)
916{
917 new bool:knife = false;
918 if(StrContains(Classname, "weapon_knife", false) == 0 || StrContains(Classname, "weapon_bayonet", false) == 0)
919 {
920 knife = true;
921 }
922
923 //PrintToChat(client, "weapon %s", Classname);
924 new ammo, clip;
925 if(!knife)
926 {
927 ammo = GetReserveAmmo(windex);
928 clip = GetEntProp(windex, Prop_Send, "m_iClip1");
929 }
930 RemovePlayerItem(client, windex);
931 AcceptEntityInput(windex, "Kill");
932
933 new entity;
934 if(zombiesv && knife) GivePlayerItem(client, "weapon_knife");
935 else entity = GivePlayerItem(client, Classname);
936
937 if(knife)
938 {
939 if (weaponindex != 42 && weaponindex != 59 && !zombiesv)
940 EquipPlayerWeapon(client, entity);
941 }
942 else
943 {
944 SetReserveAmmo(entity, ammo);
945 SetEntProp(entity, Prop_Send, "m_iClip1", clip);
946 }
947}
948
949ChangePaint(entity, theindex)
950{
951 if(theindex == 0)
952 {
953 theindex = GetRandomInt(1, g_paintCount-1);
954 }
955 else if(theindex == -1) return;
956
957/* new m_iItemIDHigh = GetEntProp(entity, Prop_Send, "m_iItemIDHigh");
958 new m_iItemIDLow = GetEntProp(entity, Prop_Send, "m_iItemIDLow"); */
959
960 SetEntProp(entity,Prop_Send,"m_iItemIDLow",-1);
961 //SetEntProp(entity,Prop_Send,"m_iItemIDHigh",0);
962
963 SetEntProp(entity,Prop_Send,"m_nFallbackPaintKit",g_paints[theindex][index]);
964 if(g_paints[theindex][wear] >= 0.0) SetEntPropFloat(entity,Prop_Send,"m_flFallbackWear",g_paints[theindex][wear]);
965 if(g_paints[theindex][pattern] >= 0) SetEntProp(entity,Prop_Send,"m_nFallbackSeed",g_paints[theindex][pattern]);
966 if(g_paints[theindex][stattrak] != -2) SetEntProp(entity,Prop_Send,"m_nFallbackStatTrak",g_paints[theindex][stattrak]);
967 if(g_paints[theindex][quality] != -2) SetEntProp(entity,Prop_Send,"m_iEntityQuality",g_paints[theindex][quality]);
968
969/* new Handle:pack;
970
971 CreateDataTimer(0.2, RestoreItemID, pack);
972 WritePackCell(pack,EntIndexToEntRef(entity));
973 WritePackCell(pack,m_iItemIDHigh);
974 WritePackCell(pack,m_iItemIDLow); */
975}
976
977public OnClientPutInServer(client)
978{
979 if(!IsFakeClient(client)) SDKHook(client, SDKHook_WeaponEquipPost, OnPostWeaponEquip);
980}
981
982public OnPostWeaponEquip(client, weapon)
983{
984 if(onlyadmin && GetUserAdmin(client) == INVALID_ADMIN_ID) return;
985
986 if(weapon < 1 || !IsValidEdict(weapon) || !IsValidEntity(weapon)) return;
987
988 if (GetEntProp(weapon, Prop_Send, "m_hPrevOwner") > 0)
989 return;
990
991 decl String:Classname[64];
992 if(!GetEdictClassname(weapon, Classname, 64) || StrEqual(Classname, "weapon_taser") || (!g_c4 && StrEqual(Classname, "weapon_c4")))
993 {
994 return;
995 }
996 ReplaceString(Classname, 64, "weapon_", "");
997 new weaponindex = GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex");
998 if(weaponindex == 42 || weaponindex == 59)
999 {
1000 return;
1001 }
1002
1003 switch (weaponindex)
1004 {
1005 case 60: strcopy(Classname, 64, "m4a1_silencer");
1006 case 61: strcopy(Classname, 64, "usp_silencer");
1007 case 63: strcopy(Classname, 64, "cz75a");
1008 case 500: strcopy(Classname, 64, "bayonet");
1009 case 506: strcopy(Classname, 64, "knife_gut");
1010 case 505: strcopy(Classname, 64, "knife_flip");
1011 case 508: strcopy(Classname, 64, "knife_m9_bayonet");
1012 case 507: strcopy(Classname, 64, "knife_karambit");
1013 case 509: strcopy(Classname, 64, "knife_tactical");
1014 case 515: strcopy(Classname, 64, "knife_butterfly");
1015 case 512: strcopy(Classname, 64, "knife_falchion");
1016 case 516: strcopy(Classname, 64, "knife_push");
1017 case 64: strcopy(Classname, 64, "revolver");
1018 case 514: strcopy(Classname, 64, "knife_survival_bowie");
1019 }
1020 if(arbol[client] == INVALID_HANDLE) return;
1021 new valor = 0;
1022 if(!GetTrieValue(arbol[client], Classname, valor)) return;
1023 if(valor == -1 || (valor != 0 && g_paints[valor][index] == 0)) return;
1024 //PrintToChat(client, "prueba");
1025 ChangePaint(weapon, valor);
1026}
1027
1028CrearMenu1(client)
1029{
1030
1031 menu1[client] = CreateMenu(DIDMenuHandler_armas);
1032 SetMenuTitle(menu1[client], "%T","Menu title 1", client);
1033
1034 new String:Items[64];
1035
1036 decl String:temp[128], String:temp1[64];
1037 new valor;
1038 for(new i=0;i<GetArraySize(array_armas);++i)
1039 {
1040 GetArrayString(array_armas, i, Items, 64);
1041 if(GetTrieValue(arbol[client], Items, valor))
1042 {
1043 if(valor == -1) Format(temp, 128, "%s", Items);
1044 else if (valor == 0)
1045 {
1046 Format(temp1, sizeof(temp1), "%T", "Random paint", client);
1047 Format(temp, 128, "%s - %s", Items, temp1);
1048 }
1049 else Format(temp, 128, "%s - %s", Items, g_paints[valor][Nombre]);
1050 }
1051 else Format(temp, 128, "%s", Items);
1052 AddMenuItem(menu1[client], Items, temp);
1053 }
1054}
1055
1056public DIDMenuHandler_armas(Handle:menu, MenuAction:action, client, itemNum)
1057{
1058 if ( action == MenuAction_Select )
1059 {
1060 decl String:info[64];
1061
1062 GetMenuItem(menu, itemNum, info, sizeof(info));
1063
1064 Format(s_arma[client], 64, info);
1065 s_sele[client] = GetMenuSelectionPosition();
1066 ShowMenu(client, 0);
1067 }
1068}
1069
1070public PruneDatabase()
1071{
1072 if (db == INVALID_HANDLE)
1073 {
1074 LogToFileEx(g_sCmdLogPath, "Prune Database: No connection");
1075 ComprobarDB();
1076 return;
1077 }
1078
1079 new maxlastaccuse;
1080 maxlastaccuse = GetTime() - (IDAYS * 86400);
1081
1082 decl String:buffer[1024];
1083
1084 if (ismysql == 1)
1085 Format(buffer, sizeof(buffer), "DELETE FROM `weaponpaints` WHERE `last_accountuse`<'%d' AND `last_accountuse`>'0';", maxlastaccuse);
1086 else
1087 Format(buffer, sizeof(buffer), "DELETE FROM weaponpaints WHERE last_accountuse<'%d' AND last_accountuse>'0';", maxlastaccuse);
1088
1089 LogToFileEx(g_sCmdLogPath, "Query %s", buffer);
1090 SQL_TQuery(db, tbasicoP, buffer);
1091}
1092
1093public OnPluginStart()
1094{
1095 for(new i=0;;i++)
1096 {
1097 BuildPath(Path_SM, g_sCmdLogPath, sizeof(g_sCmdLogPath), "logs/weaponpaints_%d.log", i);
1098 if ( !FileExists(g_sCmdLogPath) )
1099 break;
1100 }
1101
1102 LoadTranslations ("franug_weaponpaints.phrases");
1103
1104 CreateConVar("sm_wpaints_version", DATA, "", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_CHEAT|FCVAR_DONTRECORD);
1105
1106 HookEvent("round_start", roundStart);
1107
1108 RegConsoleCmd("buyammo1", GetSkins);
1109 RegConsoleCmd("sm_ws", GetSkins);
1110 RegConsoleCmd("sm_wskins", GetSkins);
1111 RegConsoleCmd("sm_paints", GetSkins);
1112
1113 RegAdminCmd("sm_reloadwskins", ReloadSkins, ADMFLAG_ROOT);
1114
1115 cvar_c4 = CreateConVar("sm_weaponpaints_c4", "1", "Enable or disable that people can apply paints to the C4. 1 = enabled, 0 = disabled");
1116 cvar_saytimer = CreateConVar("sm_weaponpaints_saytimer", "10", "Time in seconds for block that show the plugin commands in chat when someone type a command. -1.0 = never show the commands in chat");
1117 cvar_rtimer = CreateConVar("sm_weaponpaints_roundtimer", "20", "Time in seconds roundstart for can use the commands for change the paints. -1.0 = always can use the command");
1118 cvar_rmenu = CreateConVar("sm_weaponpaints_rmenu", "1", "Re-open the menu when you select a option. 1 = enabled, 0 = disabled.");
1119 cvar_onlyadmin = CreateConVar("sm_weaponpaints_onlyadmin", "1", "This feature is only for admins. 1 = enabled, 0 = disabled.");
1120 cvar_zombiesv = CreateConVar("sm_weaponpaints_zombiesv", "1", "Enable this for prevent crashes in zombie servers. 1 = enabled, 0 = disabled.");
1121
1122 g_c4 = GetConVarBool(cvar_c4);
1123 g_saytimer = GetConVarInt(cvar_saytimer);
1124 g_rtimer = GetConVarInt(cvar_rtimer);
1125 g_rmenu = GetConVarBool(cvar_rmenu);
1126 onlyadmin = GetConVarBool(cvar_onlyadmin);
1127 zombiesv = GetConVarBool(cvar_zombiesv);
1128
1129 HookConVarChange(cvar_c4, OnConVarChanged);
1130 HookConVarChange(cvar_saytimer, OnConVarChanged);
1131 HookConVarChange(cvar_rtimer, OnConVarChanged);
1132 HookConVarChange(cvar_rmenu, OnConVarChanged);
1133 HookConVarChange(cvar_onlyadmin, OnConVarChanged);
1134 HookConVarChange(cvar_zombiesv, OnConVarChanged);
1135
1136 array_paints = CreateArray(64);
1137 ReadPaints();
1138
1139 new String:Items[64];
1140
1141 if(array_armas != INVALID_HANDLE) CloseHandle(array_armas);
1142
1143 array_armas = CreateArray(128);
1144
1145 Format(Items, 64, "negev");
1146 //Format(Items[desc], 64, "Negev");
1147 PushArrayString(array_armas, Items);
1148
1149 Format(Items, 64, "m249");
1150 //Format(Items[desc], 64, "M249");
1151 PushArrayString(array_armas, Items);
1152
1153 Format(Items, 64, "bizon");
1154 //Format(Items[desc], 64, "PP-Bizon");
1155 PushArrayString(array_armas, Items);
1156
1157 Format(Items, 64, "p90");
1158 //Format(Items[desc], 64, "P90");
1159 PushArrayString(array_armas, Items);
1160
1161 Format(Items, 64, "scar20");
1162 //Format(Items[desc], 64, "SCAR-20");
1163 PushArrayString(array_armas, Items);
1164
1165 Format(Items, 64, "g3sg1");
1166 //Format(Items[desc], 64, "G3SG1");
1167 PushArrayString(array_armas, Items);
1168
1169 Format(Items, 64, "m4a1");
1170 //Format(Items[desc], 64, "M4A1");
1171 PushArrayString(array_armas, Items);
1172
1173 Format(Items, 64, "m4a1_silencer");
1174 //Format(Items[desc], 64, "M4A1-S");
1175 PushArrayString(array_armas, Items);
1176
1177 Format(Items, 64, "ak47");
1178 //Format(Items[desc], 64, "AK-47");
1179 PushArrayString(array_armas, Items);
1180
1181 Format(Items, 64, "aug");
1182 //Format(Items[desc], 64, "AUG");
1183 PushArrayString(array_armas, Items);
1184
1185 Format(Items, 64, "galilar");
1186 //Format(Items[desc], 64, "Galil AR");
1187 PushArrayString(array_armas, Items);
1188
1189 Format(Items, 64, "awp");
1190 //Format(Items[desc], 64, "AWP");
1191 PushArrayString(array_armas, Items);
1192
1193 Format(Items, 64, "sg556");
1194 //Format(Items[desc], 64, "SG 553");
1195 PushArrayString(array_armas, Items);
1196
1197 Format(Items, 64, "ump45");
1198 //Format(Items[desc], 64, "UMP-45");
1199 PushArrayString(array_armas, Items);
1200
1201 Format(Items, 64, "mp7");
1202 //Format(Items[desc], 64, "MP7");
1203 PushArrayString(array_armas, Items);
1204
1205 Format(Items, 64, "famas");
1206 //Format(Items[desc], 64, "FAMAS");
1207 PushArrayString(array_armas, Items);
1208
1209 Format(Items, 64, "mp9");
1210 //Format(Items[desc], 64, "MP9");
1211 PushArrayString(array_armas, Items);
1212
1213 Format(Items, 64, "mac10");
1214 //Format(Items[desc], 64, "MAC-10");
1215 PushArrayString(array_armas, Items);
1216
1217 Format(Items, 64, "ssg08");
1218 //Format(Items[desc], 64, "SSG 08");
1219 PushArrayString(array_armas, Items);
1220
1221 Format(Items, 64, "nova");
1222 //Format(Items[desc], 64, "Nova");
1223 PushArrayString(array_armas, Items);
1224
1225 Format(Items, 64, "xm1014");
1226 //Format(Items[desc], 64, "XM1014");
1227 PushArrayString(array_armas, Items);
1228
1229 Format(Items, 64, "sawedoff");
1230 //Format(Items[desc], 64, "Sawed-Off");
1231 PushArrayString(array_armas, Items);
1232
1233 Format(Items, 64, "mag7");
1234 //Format(Items[desc], 64, "MAG-7");
1235 PushArrayString(array_armas, Items);
1236
1237
1238
1239 // Secondary weapons
1240 Format(Items, 64, "elite");
1241 //Format(Items[desc], 64, "Dual Berettas");
1242 PushArrayString(array_armas, Items);
1243
1244 Format(Items, 64, "deagle");
1245 //Format(Items[desc], 64, "Desert Eagle");
1246 PushArrayString(array_armas, Items);
1247
1248 Format(Items, 64, "tec9"); // 26
1249 //Format(Items[desc], 64, "Tec-9");
1250 PushArrayString(array_armas, Items);
1251
1252 Format(Items, 64, "fiveseven");
1253 //Format(Items[desc], 64, "Five-SeveN");
1254 PushArrayString(array_armas, Items);
1255
1256 Format(Items, 64, "cz75a");
1257 //Format(Items[desc], 64, "CZ75-Auto");
1258 PushArrayString(array_armas, Items);
1259
1260 Format(Items, 64, "glock");
1261 PushArrayString(array_armas, Items);
1262
1263 Format(Items, 64, "usp_silencer");
1264 //Format(Items[desc], 64, "USP-S");
1265 PushArrayString(array_armas, Items);
1266
1267 Format(Items, 64, "p250");
1268 //Format(Items[desc], 64, "P250");
1269 PushArrayString(array_armas, Items);
1270
1271 Format(Items, 64, "hkp2000");
1272 //Format(Items[desc], 64, "P2000");
1273 PushArrayString(array_armas, Items);
1274
1275 Format(Items, 64, "bayonet");
1276 PushArrayString(array_armas, Items);
1277
1278 Format(Items, 64, "knife_gut");
1279 PushArrayString(array_armas, Items);
1280
1281 Format(Items, 64, "knife_flip");
1282 PushArrayString(array_armas, Items);
1283
1284 Format(Items, 64, "knife_m9_bayonet");
1285 PushArrayString(array_armas, Items);
1286
1287 Format(Items, 64, "knife_karambit");
1288 PushArrayString(array_armas, Items);
1289
1290 Format(Items, 64, "knife_tactical");
1291 PushArrayString(array_armas, Items);
1292
1293 Format(Items, 64, "knife_butterfly");
1294 PushArrayString(array_armas, Items);
1295
1296 Format(Items, 64, "c4");
1297 PushArrayString(array_armas, Items);
1298
1299 Format(Items, 64, "knife_falchion");
1300 PushArrayString(array_armas, Items);
1301
1302 Format(Items, 64, "knife_push");
1303 PushArrayString(array_armas, Items);
1304
1305 Format(Items, 64, "revolver");
1306 PushArrayString(array_armas, Items);
1307
1308 Format(Items, 64, "knife_survival_bowie");
1309 PushArrayString(array_armas, Items);
1310
1311 for (new client = 1; client <= MaxClients; client++)
1312 {
1313 if (!IsClientInGame(client))
1314 continue;
1315
1316 OnClientPutInServer(client);
1317
1318 }
1319
1320 ComprobarDB(true, "weaponpaints");
1321}