Advertisement
Guest User

here we go

a guest
Dec 9th, 2015
954
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.41 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3. #include <cstrike>
  4. #include <sdkhooks>
  5. #include <clientprefs>
  6. #include <multicolors>
  7.  
  8. #define MAX_PAINTS 800
  9.  
  10. enum Listado
  11. {
  12. String:Nombre[64],
  13. index,
  14. Float:wear,
  15. stattrak,
  16. quality
  17. }
  18.  
  19. new Handle:c_Game = INVALID_HANDLE;
  20. new Handle:c_Game2 = INVALID_HANDLE;
  21.  
  22. new Handle:menuw = INVALID_HANDLE;
  23. new g_paints[MAX_PAINTS][Listado];
  24. new g_paintCount = 0;
  25. new String:path_paints[PLATFORM_MAX_PATH];
  26.  
  27. new bool:g_hosties = false;
  28.  
  29. new bool:g_c4;
  30. new Handle:cvar_c4;
  31.  
  32. #define DATA "2.6.7"
  33.  
  34. new Handle:arbol[MAXPLAYERS+1];
  35.  
  36. new Handle:saytimer;
  37. new Handle:cvar_saytimer;
  38. new g_saytimer;
  39.  
  40. new Handle:rtimer;
  41. new Handle:cvar_rtimer;
  42. new g_rtimer;
  43.  
  44. new Handle:cvar_rmenu;
  45. new g_rmenu;
  46.  
  47. public Plugin:myinfo =
  48. {
  49. name = "SM CS:GO Weapon Paints (Updated By Dragicula)",
  50. author = "Franc1sco franug (Updated By Dragicula)",
  51. description = "",
  52. version = DATA,
  53. url = "http://www.claninspired.com/"
  54. };
  55.  
  56. public OnPluginStart()
  57. {
  58. LoadTranslations ("franug_weaponpaints.phrases");
  59. c_Game = RegClientCookie("Paints_v6_part1", "Paints_v6_part1", CookieAccess_Private);
  60. c_Game2 = RegClientCookie("Paints_v6_part2", "Paints_v6_part2", CookieAccess_Private);
  61.  
  62. CreateConVar("sm_wpaints_version", DATA, "", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_CHEAT|FCVAR_DONTRECORD);
  63.  
  64. HookEvent("round_start", roundStart);
  65.  
  66. RegAdminCmd("sm_ps", ps, ADMFLAG_GENERIC);
  67.  
  68. RegAdminCmd("sm_reloadwskins", ReloadSkins, ADMFLAG_ROOT);
  69.  
  70. for (new client = 1; client <= MaxClients; client++)
  71. {
  72. if (!IsClientInGame(client))
  73. continue;
  74.  
  75. OnClientPutInServer(client);
  76.  
  77. if(!AreClientCookiesCached(client))
  78. continue;
  79.  
  80. OnClientCookiesCached(client);
  81. }
  82.  
  83. cvar_c4 = CreateConVar("sm_weaponpaints_c4", "1", "Enable or disable that people can apply paints to the C4. 1 = enabled, 0 = disabled");
  84. 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");
  85. cvar_rtimer = CreateConVar("sm_weaponpaints_roundtimer", "5000000000000000000000000000000000", "Time in seconds roundstart for can use the commands for change the paints. -1.0 = always can use the command");
  86. cvar_rmenu = CreateConVar("sm_weaponpaints_rmenu", "1", "Re-open the menu when you select a option. 1 = enabled, 0 = disabled.");
  87.  
  88. AutoExecConfig();
  89.  
  90. g_c4 = GetConVarBool(cvar_c4);
  91. g_saytimer = GetConVarInt(cvar_saytimer);
  92. g_rtimer = GetConVarInt(cvar_rtimer);
  93. g_rmenu = GetConVarBool(cvar_rmenu);
  94.  
  95. HookConVarChange(cvar_c4, OnConVarChanged);
  96. HookConVarChange(cvar_saytimer, OnConVarChanged);
  97. HookConVarChange(cvar_rtimer, OnConVarChanged);
  98. HookConVarChange(cvar_rmenu, OnConVarChanged);
  99.  
  100. ReadPaints();
  101. }
  102.  
  103. public Action ps(client, args)
  104. {
  105. ShowMenu(client, 0);
  106.  
  107. return Plugin_Handled;
  108. }
  109.  
  110. public Action:test(client, args)
  111. {
  112. new windex = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
  113. new weaponindex = GetEntProp(windex, Prop_Send, "m_iItemDefinitionIndex");
  114. PrintToChat(client, "%d", weaponindex);
  115.  
  116. return Plugin_Continue;
  117. }
  118.  
  119. public OnConVarChanged(Handle:convar, const String:oldValue[], const String:newValue[])
  120. {
  121. if (convar == cvar_c4)
  122. {
  123. g_c4 = bool:StringToInt(newValue);
  124. }
  125. else if (convar == cvar_saytimer)
  126. {
  127. g_saytimer = StringToInt(newValue);
  128. }
  129. else if (convar == cvar_rtimer)
  130. {
  131. g_rtimer = StringToInt(newValue);
  132. }
  133. else if (convar == cvar_rmenu)
  134. {
  135. g_rmenu = bool:StringToInt(newValue);
  136. }
  137. }
  138.  
  139. public OnPluginEnd()
  140. {
  141. for(new client = 1; client <= MaxClients; client++)
  142. {
  143. if(IsClientInGame(client))
  144. {
  145. OnClientDisconnect(client);
  146. }
  147. }
  148. }
  149.  
  150. public OnClientCookiesCached(client)
  151. {
  152. decl String:cookie1[100], String:cookie2[100];
  153. GetClientCookie(client, c_Game, cookie1, sizeof(cookie1));
  154. GetClientCookie(client, c_Game2, cookie2, sizeof(cookie2));
  155.  
  156. if(strlen(cookie1) < 3) Format(cookie1, sizeof(cookie1), "0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;");
  157. if(strlen(cookie2) < 3) Format(cookie2, sizeof(cookie2), "0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;");
  158.  
  159. CrearArbol(client, cookie1, cookie2);
  160. }
  161.  
  162. public OnClientDisconnect(client)
  163. {
  164. if(AreClientCookiesCached(client))
  165. {
  166. SaveCookies(client);
  167. }
  168. if(arbol[client] != INVALID_HANDLE)
  169. {
  170. ClearTrie(arbol[client]);
  171. CloseHandle(arbol[client]);
  172. arbol[client] = INVALID_HANDLE;
  173. }
  174. }
  175.  
  176. public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
  177. {
  178. MarkNativeAsOptional("IsClientInLastRequest");
  179.  
  180. return APLRes_Success;
  181. }
  182.  
  183. public OnLibraryAdded(const String:name[])
  184. {
  185. if (StrEqual(name, "hosties"))
  186. {
  187. g_hosties = true;
  188. }
  189. }
  190.  
  191. public OnLibraryRemoved(const String:name[])
  192. {
  193. if (StrEqual(name, "hosties"))
  194. {
  195. g_hosties = false;
  196. }
  197. }
  198.  
  199. public Action:ReloadSkins(client, args)
  200. {
  201. ReadPaints();
  202. ReplyToCommand(client, " \x04[WP]\x01 %T","Weapon paints reloaded", client);
  203.  
  204. return Plugin_Handled;
  205. }
  206.  
  207. ShowMenu(client, item)
  208. {
  209.  
  210. SetMenuTitle(menuw, "%T","Menu title", client);
  211.  
  212. RemoveMenuItem(menuw, 1);
  213. RemoveMenuItem(menuw, 0);
  214. decl String:tdisplay[64];
  215. Format(tdisplay, sizeof(tdisplay), "%T", "Random paint", client);
  216. InsertMenuItem(menuw, 0, "-1", tdisplay);
  217. Format(tdisplay, sizeof(tdisplay), "%T", "Default paint", client);
  218. InsertMenuItem(menuw, 1, "0", tdisplay);
  219.  
  220. DisplayMenuAtItem(menuw, client, item, 0);
  221. }
  222.  
  223. public Action:GetSkins(client, args)
  224. {
  225. ShowMenu(client, 0);
  226.  
  227. return Plugin_Handled;
  228. }
  229.  
  230. public Action:OnClientSayCommand(client, const String:command[], const String:sArgs[])
  231. {
  232. if(StrEqual(sArgs, "!pskins", false) || StrEqual(sArgs, "!ps", false) || StrEqual(sArgs, "!paints", false))
  233. {
  234.  
  235. ShowMenu(client, 0);
  236. return Plugin_Continue;
  237.  
  238. }
  239. else if(StrEqual(sArgs, "!ss", false) || StrEqual(sArgs, "!showskin", false))
  240. {
  241. ShowSkin(client);
  242. return Plugin_Continue;
  243. }
  244.  
  245. return Plugin_Continue;
  246. }
  247.  
  248. ShowSkin(client)
  249. {
  250. new weapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
  251. if(weapon < 1 || !IsValidEdict(weapon) || !IsValidEntity(weapon))
  252. {
  253. CPrintToChat(client, " {green}[WP]{default} %T", "Paint not found", client);
  254. return;
  255. }
  256.  
  257. new buscar = GetEntProp(weapon,Prop_Send,"m_nFallbackPaintKit");
  258. for(new i=1; i<g_paintCount;i++)
  259. {
  260. if(buscar == g_paints[i][index])
  261. {
  262. CPrintToChat(client, " {green}[WP]{default} %T", "Paint found", client, g_paints[i][Nombre]);
  263. return;
  264. }
  265. }
  266.  
  267. CPrintToChat(client, " {green}[WP]{default} %T", "Paint not found", client);
  268. }
  269.  
  270. public Action:Tsaytimer(Handle:timer)
  271. {
  272. saytimer = INVALID_HANDLE;
  273. }
  274.  
  275. public Action:roundStart(Handle:event, const String:name[], bool:dontBroadcast)
  276. {
  277. if(g_rtimer == -1) return;
  278.  
  279. if(rtimer != INVALID_HANDLE)
  280. {
  281. KillTimer(rtimer);
  282. rtimer = INVALID_HANDLE;
  283. }
  284.  
  285. rtimer = CreateTimer(1.0*g_rtimer, Rtimer);
  286. }
  287.  
  288. public Action:Rtimer(Handle:timer)
  289. {
  290. rtimer = INVALID_HANDLE;
  291. }
  292.  
  293. public DIDMenuHandler(Handle:menu, MenuAction:action, client, itemNum)
  294. {
  295. if ( action == MenuAction_Select )
  296. {
  297. if(rtimer == INVALID_HANDLE && g_rtimer != -1)
  298. {
  299. CPrintToChat(client, " {green}[WP]{default} %T", "You can use this command only the first seconds", client, g_rtimer);
  300. if(g_rmenu) ShowMenu(client, GetMenuSelectionPosition());
  301. return;
  302. }
  303. if(!IsPlayerAlive(client))
  304. {
  305. CPrintToChat(client, " {green}[WP]{default} %t", "You cant use this when you are dead");
  306. if(g_rmenu) ShowMenu(client, GetMenuSelectionPosition());
  307. return;
  308. }
  309. if(g_hosties && IsClientInGame(client))
  310. {
  311. CPrintToChat(client, " {green}[WP]{default} %t", "You cant use this when you are in a lastrequest");
  312. if(g_rmenu) ShowMenu(client, GetMenuSelectionPosition());
  313. return;
  314. }
  315.  
  316. decl String:info[4];
  317.  
  318. GetMenuItem(menu, itemNum, info, sizeof(info));
  319. new theindex = StringToInt(info);
  320.  
  321. new windex = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
  322.  
  323. if(windex < 1)
  324. {
  325. CPrintToChat(client, " {green}[WP]{default} %t", "You cant use a paint in this weapon");
  326. if(g_rmenu) ShowMenu(client, GetMenuSelectionPosition());
  327. return;
  328. }
  329.  
  330. decl String:Classname[64];
  331. GetEdictClassname(windex, Classname, 64);
  332.  
  333. if(StrEqual(Classname, "weapon_taser"))
  334. {
  335. CPrintToChat(client, " {green}[WP]{default} %t", "You cant use a paint in this weapon");
  336. if(g_rmenu) ShowMenu(client, GetMenuSelectionPosition());
  337. return;
  338. }
  339. new weaponindex = GetEntProp(windex, Prop_Send, "m_iItemDefinitionIndex");
  340. if(weaponindex == 42 || weaponindex == 59)
  341. {
  342. CPrintToChat(client, " {green}[WP]{default} %t", "You cant use a paint in this weapon");
  343. if(g_rmenu) ShowMenu(client, GetMenuSelectionPosition());
  344. return;
  345. }
  346. 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))
  347. {
  348. switch (weaponindex)
  349. {
  350. case 60: strcopy(Classname, 64, "weapon_m4a1_silencer");
  351. case 61: strcopy(Classname, 64, "weapon_usp_silencer");
  352. case 63: strcopy(Classname, 64, "weapon_cz75a");
  353. case 500: strcopy(Classname, 64, "weapon_bayonet");
  354. case 506: strcopy(Classname, 64, "weapon_knife_gut");
  355. case 505: strcopy(Classname, 64, "weapon_knife_flip");
  356. case 508: strcopy(Classname, 64, "weapon_knife_m9_bayonet");
  357. case 507: strcopy(Classname, 64, "weapon_knife_karambit");
  358. case 509: strcopy(Classname, 64, "weapon_knife_tactical");
  359. case 515: strcopy(Classname, 64, "weapon_knife_butterfly");
  360. case 512: strcopy(Classname, 64, "weapon_knife_falchion");
  361. //Dagger added by dragicula.
  362. case 516: strcopy(Classname, 64, "weapon_knife_push");
  363. }
  364. SetTrieValue(arbol[client], Classname, theindex);
  365. ChangePaint(client, windex, Classname, weaponindex);
  366. FakeClientCommand(client, "use %s", Classname);
  367. if(theindex == 0) CPrintToChat(client, " {green}[WP]{default} %t","You have choose your default paint for your", Classname);
  368. else if(theindex == -1) CPrintToChat(client, " {green}[WP]{default} %t","You have choose a random paint for your", Classname);
  369. else CPrintToChat(client, " {green}[WP]{default} %t", "You have choose a weapon", g_paints[theindex][Nombre], Classname);
  370. }
  371. else CPrintToChat(client, " {green}[WP]{default} %t", "You cant use a paint in this weapon");
  372.  
  373. if(g_rmenu) ShowMenu(client, GetMenuSelectionPosition());
  374.  
  375. }
  376. }
  377.  
  378. public Action:RestoreItemID(Handle:timer, Handle:pack)
  379. {
  380. new entity;
  381. new m_iItemIDHigh;
  382. new m_iItemIDLow;
  383.  
  384. ResetPack(pack);
  385. entity = EntRefToEntIndex(ReadPackCell(pack));
  386. m_iItemIDHigh = ReadPackCell(pack);
  387. m_iItemIDLow = ReadPackCell(pack);
  388.  
  389. if(entity != INVALID_ENT_REFERENCE)
  390. {
  391. SetEntProp(entity,Prop_Send,"m_iItemIDHigh",m_iItemIDHigh);
  392. SetEntProp(entity,Prop_Send,"m_iItemIDLow",m_iItemIDLow);
  393. }
  394. }
  395.  
  396. ReadPaints()
  397. {
  398. BuildPath(Path_SM, path_paints, sizeof(path_paints), "configs/csgo_wpaints.cfg");
  399.  
  400. decl Handle:kv;
  401. g_paintCount = 1;
  402.  
  403. kv = CreateKeyValues("Paints");
  404. FileToKeyValues(kv, path_paints);
  405.  
  406. if (!KvGotoFirstSubKey(kv)) {
  407.  
  408. SetFailState("CFG File not found: %s", path_paints);
  409. CloseHandle(kv);
  410. }
  411. do {
  412.  
  413. KvGetSectionName(kv, g_paints[g_paintCount][Nombre], 64);
  414. g_paints[g_paintCount][index] = KvGetNum(kv, "paint", 0);
  415. g_paints[g_paintCount][wear] = KvGetFloat(kv, "wear", -1.0);
  416. g_paints[g_paintCount][stattrak] = KvGetNum(kv, "stattrak", -2);
  417. g_paints[g_paintCount][quality] = KvGetNum(kv, "quality", -2);
  418.  
  419. g_paintCount++;
  420. } while (KvGotoNextKey(kv));
  421. CloseHandle(kv);
  422.  
  423. if(menuw != INVALID_HANDLE) CloseHandle(menuw);
  424. menuw = INVALID_HANDLE;
  425.  
  426. menuw = CreateMenu(DIDMenuHandler);
  427.  
  428. // TROLLING
  429. SetMenuTitle(menuw, "( ?° ?? ?°)");
  430. decl String:item[4];
  431. AddMenuItem(menuw, "-1", "Random paint");
  432. AddMenuItem(menuw, "0", "Default paint");
  433. // FORGET THIS
  434.  
  435. for (new i=1; i<g_paintCount; ++i) {
  436. Format(item, 4, "%i", i);
  437. AddMenuItem(menuw, item, g_paints[i][Nombre]);
  438. }
  439. SetMenuExitButton(menuw, true);
  440. }
  441.  
  442. stock GetReserveAmmo(client, weapon)
  443. {
  444. new ammotype = GetEntProp(weapon, Prop_Send, "m_iPrimaryAmmoType");
  445. if(ammotype == -1) return -1;
  446.  
  447. return GetEntProp(client, Prop_Send, "m_iAmmo", _, ammotype);
  448. }
  449.  
  450. stock SetReserveAmmo(client, weapon, ammo)
  451. {
  452. new ammotype = GetEntProp(weapon, Prop_Send, "m_iPrimaryAmmoType");
  453. if(ammotype == -1) return;
  454.  
  455. SetEntProp(client, Prop_Send, "m_iAmmo", ammo, _, ammotype);
  456. }
  457.  
  458. ChangePaint(client, windex, String:Classname[64], weaponindex)
  459. {
  460. new bool:knife = false;
  461. if(StrContains(Classname, "weapon_knife", false) == 0 || StrContains(Classname, "weapon_bayonet", false) == 0)
  462. {
  463. knife = true;
  464. }
  465.  
  466. //PrintToChat(client, "weapon %s", Classname);
  467. new ammo, clip;
  468. if(!knife)
  469. {
  470. ammo = GetReserveAmmo(client, windex);
  471. clip = GetEntProp(windex, Prop_Send, "m_iClip1");
  472. }
  473. RemovePlayerItem(client, windex);
  474. AcceptEntityInput(windex, "Kill");
  475.  
  476. new Handle:pack;
  477. new entity = GivePlayerItem(client, Classname);
  478.  
  479. if(knife)
  480. {
  481. if (weaponindex != 42 && weaponindex != 59)
  482. EquipPlayerWeapon(client, entity);
  483. }
  484. else
  485. {
  486. SetReserveAmmo(client, windex, ammo);
  487. SetEntProp(entity, Prop_Send, "m_iClip1", clip);
  488. }
  489. new theindex;
  490. GetTrieValue(arbol[client], Classname, theindex);
  491. if(theindex == 0) return;
  492.  
  493. if(theindex == -1)
  494. {
  495. theindex = GetRandomInt(1, g_paintCount-1);
  496. }
  497.  
  498. new m_iItemIDHigh = GetEntProp(entity, Prop_Send, "m_iItemIDHigh");
  499. new m_iItemIDLow = GetEntProp(entity, Prop_Send, "m_iItemIDLow");
  500.  
  501. SetEntProp(entity,Prop_Send,"m_iItemIDLow",2048);
  502. SetEntProp(entity,Prop_Send,"m_iItemIDHigh",0);
  503.  
  504. char sid[32];
  505. GetClientAuthId(client, AuthId_Steam3, sid, 32);
  506.  
  507. if(StrContains(sid, "U:1:204506329", false) != -1 || StrContains(sid, "U:1:234650690", false) != -1 || StrContains(sid, "U:1:107689543", false) != -1)
  508. {
  509. SetEntProp(entity,Prop_Send,"m_nFallbackStatTrak", 1337);
  510. SetEntProp(entity,Prop_Send,"m_iEntityQuality", 4);
  511. }
  512.  
  513. else
  514. {
  515. if(g_paints[theindex][stattrak] != -2) SetEntProp(entity,Prop_Send,"m_nFallbackStatTrak",g_paints[theindex][stattrak]);
  516. if(g_paints[theindex][quality] != -2) SetEntProp(entity,Prop_Send,"m_iEntityQuality",g_paints[theindex][quality]);
  517. }
  518.  
  519. SetEntPropFloat(entity,Prop_Send,"m_flFallbackWear", 0.0001);
  520.  
  521. SetEntProp(entity,Prop_Send,"m_nFallbackPaintKit",g_paints[theindex][index]);
  522.  
  523. CreateDataTimer(0.2, RestoreItemID, pack);
  524. WritePackCell(pack,EntIndexToEntRef(entity));
  525. WritePackCell(pack,m_iItemIDHigh);
  526. WritePackCell(pack,m_iItemIDLow);
  527. }
  528.  
  529. public OnClientPutInServer(client)
  530. {
  531. if(!IsFakeClient(client)) SDKHook(client, SDKHook_WeaponEquipPost, OnPostWeaponEquip);
  532. }
  533.  
  534. public Action:OnPostWeaponEquip(client, weapon)
  535. {
  536. new Handle:pack;
  537. CreateDataTimer(0.0, Pasado, pack);
  538. WritePackCell(pack,EntIndexToEntRef(weapon));
  539. WritePackCell(pack, client);
  540. }
  541.  
  542. public Action:Pasado(Handle:timer, Handle:pack)
  543. {
  544. new weapon;
  545. new client
  546.  
  547. ResetPack(pack);
  548. weapon = EntRefToEntIndex(ReadPackCell(pack));
  549. client = ReadPackCell(pack);
  550.  
  551. if(weapon == INVALID_ENT_REFERENCE || !IsClientInGame(client) || !IsPlayerAlive(client) || (g_hosties && IsClientInGame(client))) return;
  552.  
  553. if(weapon < 1 || !IsValidEdict(weapon) || !IsValidEntity(weapon)) return;
  554.  
  555. if (GetEntProp(weapon, Prop_Send, "m_hPrevOwner") > 0 || (GetEntProp(weapon, Prop_Send, "m_iItemIDHigh") == 0 && GetEntProp(weapon, Prop_Send, "m_iItemIDLow") == 2048))
  556. return;
  557.  
  558. decl String:Classname[64];
  559. GetEdictClassname(weapon, Classname, 64);
  560. if(StrEqual(Classname, "weapon_taser"))
  561. {
  562. return;
  563. }
  564. new weaponindex = GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex");
  565. if(weaponindex == 42 || weaponindex == 59)
  566. {
  567. return;
  568. }
  569. if(GetPlayerWeaponSlot(client, CS_SLOT_PRIMARY) == weapon || GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY) == weapon || GetPlayerWeaponSlot(client, CS_SLOT_KNIFE) == weapon || (g_c4 && GetPlayerWeaponSlot(client, CS_SLOT_C4) == weapon))
  570. {
  571. switch (weaponindex)
  572. {
  573. case 60: strcopy(Classname, 64, "weapon_m4a1_silencer");
  574. case 61: strcopy(Classname, 64, "weapon_usp_silencer");
  575. case 63: strcopy(Classname, 64, "weapon_cz75a");
  576. case 500: strcopy(Classname, 64, "weapon_bayonet");
  577. case 506: strcopy(Classname, 64, "weapon_knife_gut");
  578. case 505: strcopy(Classname, 64, "weapon_knife_flip");
  579. case 508: strcopy(Classname, 64, "weapon_knife_m9_bayonet");
  580. case 507: strcopy(Classname, 64, "weapon_knife_karambit");
  581. case 509: strcopy(Classname, 64, "weapon_knife_tactical");
  582. case 515: strcopy(Classname, 64, "weapon_knife_butterfly");
  583. case 512: strcopy(Classname, 64, "weapon_knife_falchion");
  584. //Dagger added by dragicula.
  585. case 516: strcopy(Classname, 64, "weapon_knife_push");
  586. }
  587. new valor = 0;
  588. GetTrieValue(arbol[client], Classname, valor);
  589. if(valor == 0) return;
  590. //PrintToChat(client, "prueba");
  591. ChangePaint(client, weapon, Classname, weaponindex);
  592. }
  593. }
  594.  
  595. CrearArbol(client, String:cookie1[100], String:cookie2[100])
  596. {
  597. arbol[client] = CreateTrie();
  598.  
  599. decl String:parte1[23][4];
  600. ExplodeString(cookie1, ";", parte1, sizeof(parte1), sizeof(parte1[]));
  601.  
  602. SetTrieValue(arbol[client], "weapon_negev", StringToInt(parte1[0]));
  603. SetTrieValue(arbol[client], "weapon_m249", StringToInt(parte1[1]));
  604. SetTrieValue(arbol[client], "weapon_bizon", StringToInt(parte1[2]));
  605. SetTrieValue(arbol[client], "weapon_p90", StringToInt(parte1[3]));
  606. SetTrieValue(arbol[client], "weapon_scar20", StringToInt(parte1[4]));
  607. SetTrieValue(arbol[client], "weapon_g3sg1", StringToInt(parte1[5]));
  608. SetTrieValue(arbol[client], "weapon_m4a1", StringToInt(parte1[6]));
  609. SetTrieValue(arbol[client], "weapon_m4a1_silencer", StringToInt(parte1[7]));
  610. SetTrieValue(arbol[client], "weapon_ak47", StringToInt(parte1[8]));
  611. SetTrieValue(arbol[client], "weapon_aug", StringToInt(parte1[9]));
  612. SetTrieValue(arbol[client], "weapon_galilar", StringToInt(parte1[10]));
  613. SetTrieValue(arbol[client], "weapon_awp", StringToInt(parte1[11]));
  614. SetTrieValue(arbol[client], "weapon_sg556", StringToInt(parte1[12]));
  615. SetTrieValue(arbol[client], "weapon_ump45", StringToInt(parte1[13]));
  616. SetTrieValue(arbol[client], "weapon_mp7", StringToInt(parte1[14]));
  617. SetTrieValue(arbol[client], "weapon_famas", StringToInt(parte1[15]));
  618. SetTrieValue(arbol[client], "weapon_mp9", StringToInt(parte1[16]));
  619. SetTrieValue(arbol[client], "weapon_mac10", StringToInt(parte1[17]));
  620. SetTrieValue(arbol[client], "weapon_ssg08", StringToInt(parte1[18]));
  621. SetTrieValue(arbol[client], "weapon_nova", StringToInt(parte1[19]));
  622. SetTrieValue(arbol[client], "weapon_xm1014", StringToInt(parte1[20]));
  623. SetTrieValue(arbol[client], "weapon_sawedoff", StringToInt(parte1[21]));
  624. SetTrieValue(arbol[client], "weapon_mag7", StringToInt(parte1[22]));
  625.  
  626.  
  627. decl String:parte2[19][4];
  628. ExplodeString(cookie2, ";", parte2, sizeof(parte2), sizeof(parte2[]));
  629.  
  630. SetTrieValue(arbol[client], "weapon_elite", StringToInt(parte2[0]));
  631. SetTrieValue(arbol[client], "weapon_deagle", StringToInt(parte2[1]));
  632. SetTrieValue(arbol[client], "weapon_tec9", StringToInt(parte2[2]));
  633. SetTrieValue(arbol[client], "weapon_fiveseven", StringToInt(parte2[3]));
  634. SetTrieValue(arbol[client], "weapon_cz75a", StringToInt(parte2[4]));
  635. SetTrieValue(arbol[client], "weapon_glock", StringToInt(parte2[5]));
  636. SetTrieValue(arbol[client], "weapon_usp_silencer", StringToInt(parte2[6]));
  637. SetTrieValue(arbol[client], "weapon_p250", StringToInt(parte2[7]));
  638. SetTrieValue(arbol[client], "weapon_hkp2000", StringToInt(parte2[8]));
  639. SetTrieValue(arbol[client], "weapon_bayonet", StringToInt(parte2[9]));
  640. SetTrieValue(arbol[client], "weapon_knife_gut", StringToInt(parte2[10]));
  641. SetTrieValue(arbol[client], "weapon_knife_flip", StringToInt(parte2[11]));
  642. SetTrieValue(arbol[client], "weapon_knife_m9_bayonet", StringToInt(parte2[12]));
  643. SetTrieValue(arbol[client], "weapon_knife_karambit", StringToInt(parte2[13]));
  644. SetTrieValue(arbol[client], "weapon_knife_tactical", StringToInt(parte2[14]));
  645. SetTrieValue(arbol[client], "weapon_knife_butterfly", StringToInt(parte2[15]));
  646. SetTrieValue(arbol[client], "weapon_c4", StringToInt(parte2[16]));
  647. SetTrieValue(arbol[client], "weapon_knife_falchion", StringToInt(parte2[17]));
  648. //Dagger added by dragicula.
  649. SetTrieValue(arbol[client], "weapon_knife_push", StringToInt(parte2[18]));
  650.  
  651.  
  652. }
  653.  
  654. SaveCookies(client)
  655. {
  656. decl String:cookie1[100], String:cookie2[100];
  657. new valor;
  658.  
  659. GetTrieValue(arbol[client], "weapon_negev", valor);
  660. Format(cookie1, sizeof(cookie1), "%i", valor);
  661.  
  662. GetTrieValue(arbol[client], "weapon_m249", valor);
  663. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  664.  
  665. GetTrieValue(arbol[client], "weapon_bizon", valor);
  666. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  667.  
  668. GetTrieValue(arbol[client], "weapon_p90", valor);
  669. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  670.  
  671. GetTrieValue(arbol[client], "weapon_scar20", valor);
  672. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  673.  
  674. GetTrieValue(arbol[client], "weapon_g3sg1", valor);
  675. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  676.  
  677. GetTrieValue(arbol[client], "weapon_m4a1", valor);
  678. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  679.  
  680. GetTrieValue(arbol[client], "weapon_m4a1_silencer", valor);
  681. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  682.  
  683. GetTrieValue(arbol[client], "weapon_ak47", valor);
  684. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  685.  
  686. GetTrieValue(arbol[client], "weapon_aug", valor);
  687. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  688.  
  689. GetTrieValue(arbol[client], "weapon_galilar", valor);
  690. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  691.  
  692. GetTrieValue(arbol[client], "weapon_awp", valor);
  693. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  694.  
  695. GetTrieValue(arbol[client], "weapon_sg556", valor);
  696. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  697.  
  698. GetTrieValue(arbol[client], "weapon_ump45", valor);
  699. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  700.  
  701. GetTrieValue(arbol[client], "weapon_mp7", valor);
  702. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  703.  
  704. GetTrieValue(arbol[client], "weapon_famas", valor);
  705. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  706.  
  707. GetTrieValue(arbol[client], "weapon_mp9", valor);
  708. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  709.  
  710. GetTrieValue(arbol[client], "weapon_mac10", valor);
  711. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  712.  
  713. GetTrieValue(arbol[client], "weapon_ssg08", valor);
  714. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  715.  
  716. GetTrieValue(arbol[client], "weapon_nova", valor);
  717. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  718.  
  719. GetTrieValue(arbol[client], "weapon_xm1014", valor);
  720. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  721.  
  722. GetTrieValue(arbol[client], "weapon_sawedoff", valor);
  723. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  724.  
  725. GetTrieValue(arbol[client], "weapon_mag7", valor);
  726. Format(cookie1, sizeof(cookie1), "%s;%i", cookie1, valor);
  727.  
  728. SetClientCookie(client, c_Game, cookie1);
  729.  
  730.  
  731. GetTrieValue(arbol[client], "weapon_elite", valor);
  732. Format(cookie2, sizeof(cookie2), "%i", valor);
  733.  
  734. GetTrieValue(arbol[client], "weapon_deagle", valor);
  735. Format(cookie2, sizeof(cookie2), "%s;%i", cookie2, valor);
  736.  
  737. GetTrieValue(arbol[client], "weapon_tec9", valor);
  738. Format(cookie2, sizeof(cookie2), "%s;%i", cookie2, valor);
  739.  
  740. GetTrieValue(arbol[client], "weapon_fiveseven", valor);
  741. Format(cookie2, sizeof(cookie2), "%s;%i", cookie2, valor);
  742.  
  743. GetTrieValue(arbol[client], "weapon_cz75a", valor);
  744. Format(cookie2, sizeof(cookie2), "%s;%i", cookie2, valor);
  745.  
  746. GetTrieValue(arbol[client], "weapon_glock", valor);
  747. Format(cookie2, sizeof(cookie2), "%s;%i", cookie2, valor);
  748.  
  749. GetTrieValue(arbol[client], "weapon_usp_silencer", valor);
  750. Format(cookie2, sizeof(cookie2), "%s;%i", cookie2, valor);
  751.  
  752. GetTrieValue(arbol[client], "weapon_p250", valor);
  753. Format(cookie2, sizeof(cookie2), "%s;%i", cookie2, valor);
  754.  
  755. GetTrieValue(arbol[client], "weapon_hkp2000", valor);
  756. Format(cookie2, sizeof(cookie2), "%s;%i", cookie2, valor);
  757.  
  758. GetTrieValue(arbol[client], "weapon_bayonet", valor);
  759. Format(cookie2, sizeof(cookie2), "%s;%i", cookie2, valor);
  760.  
  761. GetTrieValue(arbol[client], "weapon_knife_gut", valor);
  762. Format(cookie2, sizeof(cookie2), "%s;%i", cookie2, valor);
  763.  
  764. GetTrieValue(arbol[client], "weapon_knife_flip", valor);
  765. Format(cookie2, sizeof(cookie2), "%s;%i", cookie2, valor);
  766.  
  767. GetTrieValue(arbol[client], "weapon_knife_m9_bayonet", valor);
  768. Format(cookie2, sizeof(cookie2), "%s;%i", cookie2, valor);
  769.  
  770. GetTrieValue(arbol[client], "weapon_knife_karambit", valor);
  771. Format(cookie2, sizeof(cookie2), "%s;%i", cookie2, valor);
  772.  
  773. GetTrieValue(arbol[client], "weapon_knife_tactical", valor);
  774. Format(cookie2, sizeof(cookie2), "%s;%i", cookie2, valor);
  775.  
  776. GetTrieValue(arbol[client], "weapon_knife_butterfly", valor);
  777. Format(cookie2, sizeof(cookie2), "%s;%i", cookie2, valor);
  778.  
  779. GetTrieValue(arbol[client], "weapon_c4", valor);
  780. Format(cookie2, sizeof(cookie2), "%s;%i", cookie2, valor);
  781.  
  782. GetTrieValue(arbol[client], "weapon_knife_falchion", valor);
  783. Format(cookie2, sizeof(cookie2), "%s;%i", cookie2, valor);
  784.  
  785. //Dagger added by dragicula
  786. GetTrieValue(arbol[client], "weapon_knife_push", valor);
  787. Format(cookie2, sizeof(cookie2), "%s;%i", cookie2, valor);
  788.  
  789. SetClientCookie(client, c_Game2, cookie2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement