FlacoBey

Untitled

May 30th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.00 KB | None | 0 0
  1. #include sdktools
  2. #include sdkhooks
  3.  
  4. #pragma semicolon 1
  5. #pragma newdecls required
  6.  
  7. bool IsUsed[2048+1] = false;
  8.  
  9. static int ammoOffset;
  10.  
  11. public void OnMapStart()
  12. {
  13.     for(int i = 33; i <= 2048; ++i)
  14.     {
  15.         IsUsed[i] = false;
  16.     }
  17. }
  18.  
  19. public void OnPluginStart()
  20. {
  21.     ammoOffset = FindSendPropInfo("CTerrorPlayer", "m_iAmmo");
  22. }
  23.  
  24. public void OnEntityCreated(int entity, const char[] classname)
  25. {
  26.     IsUsed[entity] = false;
  27. }
  28.  
  29. public void OnClientPutInServer(int client)
  30. {
  31.     SDKHook(client, SDKHook_WeaponEquip, WeaponEquip);
  32. }
  33.  
  34. public void OnClientDisconnect(int client)
  35. {
  36.     SDKUnhook(client, SDKHook_WeaponEquip, WeaponEquip);
  37. }
  38.  
  39. public Action WeaponEquip(int client, int weapon)
  40. {
  41.     if(IsClientInGame(client) && GetClientTeam(client) == 2)
  42.     {
  43.         if(!IsUsed[weapon])
  44.         {
  45.             IsUsed[weapon] = true;
  46.             char sWeaponName[32];
  47.             GetEdictClassname(weapon, sWeaponName, sizeof(sWeaponName));
  48.             if  (StrEqual(sWeaponName, "weapon_rifle"))
  49.             {
  50.                 SetEntData(client, ammoOffset + 12, 0);
  51.                 SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 50), 1);
  52.             }
  53.             else if (StrEqual(sWeaponName, "weapon_rifle_ak47"))
  54.             {
  55.                 SetEntData(client, ammoOffset + 12, 0);
  56.                 SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 40), 1);
  57.             }
  58.             else if (StrEqual(sWeaponName, "weapon_rifle_desert"))
  59.             {
  60.                 SetEntData(client, ammoOffset + 12, 0);
  61.                 SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 60), 1);
  62.             }
  63.             else if (StrEqual(sWeaponName, "weapon_rifle_m60"))
  64.             {
  65.                 SetEntData(client, ammoOffset + 12, 0);
  66.                 SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 100), 1);
  67.             }
  68.             else if (StrEqual(sWeaponName, "weapon_smg"))  
  69.             {
  70.                 SetEntData(client, ammoOffset + 20, 0);
  71.                 SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 50), 1);
  72.             }
  73.             else if (StrEqual(sWeaponName, "weapon_smg_silenced"))
  74.             {
  75.                 SetEntData(client, ammoOffset + 20, 0);
  76.                 SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 50), 1);
  77.             }
  78.             else if (StrEqual(sWeaponName, "weapon_pumpshotgun"))
  79.             {
  80.                 SetEntData(client, ammoOffset + 28, 0);
  81.                 SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 8), 1);
  82.             }
  83.             else if (StrEqual(sWeaponName, "weapon_shotgun_chrome"))
  84.             {
  85.                 SetEntData(client, ammoOffset + 28, 0);
  86.                 SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 8), 1);
  87.             }
  88.             else if (StrEqual(sWeaponName, "weapon_autoshotgun"))  
  89.             {
  90.                 SetEntData(client, ammoOffset + 32, 0);
  91.                 SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 10), 1);
  92.             }
  93.             else if (StrEqual(sWeaponName, "weapon_shotgun_spas"))
  94.             {
  95.                 SetEntData(client, ammoOffset + 32, 0);
  96.                 SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 10), 1);
  97.             }
  98.             else if (StrEqual(sWeaponName, "weapon_hunting_rifle"))
  99.             {
  100.                 SetEntData(client, ammoOffset + 36, 0);
  101.                 SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 15), 1);
  102.             }
  103.             else if (StrEqual(sWeaponName, "weapon_sniper_military"))
  104.             {
  105.                 SetEntData(client, ammoOffset + 40, 0);
  106.                 SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 30), 1);
  107.             }
  108.             else if (StrEqual(sWeaponName, "weapon_grenade_launcher"))
  109.             {
  110.                 SetEntData(client, ammoOffset + 68, 0);
  111.                 SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 1), 1);
  112.             }
  113.             else if (StrEqual(sWeaponName, "weapon_rifle_sg552"))
  114.             {
  115.                 SetEntData(client, ammoOffset + 12, 0);
  116.                 SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 50), 1);
  117.             }
  118.             else if (StrEqual(sWeaponName, "weapon_smg_mp5"))
  119.             {
  120.                 SetEntData(client, ammoOffset + 20, 0);
  121.                 SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 50), 1);
  122.             }
  123.             else if (StrEqual(sWeaponName, "weapon_sniper_awp"))
  124.             {
  125.                 SetEntData(client, ammoOffset + 40, 0);
  126.                 SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 20), 1);
  127.             }
  128.             else if (StrEqual(sWeaponName, "weapon_sniper_scout")) 
  129.             {
  130.                 SetEntData(client, ammoOffset + 40, 0);
  131.                 SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 15), 1);
  132.             }
  133.         }
  134.     }
  135. }
Advertisement
Add Comment
Please, Sign In to add comment