FlacoBey

Untitled

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