Advertisement
FlacoBey

Untitled

Jun 10th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.26 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. static int your_ammo = 0;
  11.  
  12. public void OnPluginStart()
  13. {
  14.     ammoOffset = FindSendPropInfo("CTerrorPlayer", "m_iAmmo");
  15. }
  16.  
  17. public void OnEntityCreated(int entity, const char[] classname)
  18. {
  19.     if (IsValidEdict(entity))
  20.     {
  21.         SDKHook(entity, SDKHook_SpawnPost, SpawnPost);
  22.     }
  23. }
  24.  
  25. public void SpawnPost(int entity)
  26. {
  27.     RequestFrame(nextFrame, EntIndexToEntRef(entity));
  28. }
  29.  
  30. public void nextFrame(int entity)
  31. {
  32.     if((entity = EntRefToEntIndex(entity)) != INVALID_ENT_REFERENCE)
  33.     {
  34.         SDKHook(entity, SDKHook_SpawnPost, SpawnPost);
  35.  
  36.         int iType = GetiAmmoType(entity);
  37.         if(iType != 0)
  38.         {
  39.             for (int client = 1; client <= 32; client++)
  40.             {
  41.                 if(bIsSurvivor(client))
  42.                 {
  43.                     char sWeaponName[32];
  44.                     GetEdictClassname(entity, sWeaponName, sizeof(sWeaponName));
  45.                    
  46.                     if  (StrEqual(sWeaponName, "weapon_rifle"))         SetEntData(client, ammoOffset + 12, your_ammo);
  47.                     else if (StrEqual(sWeaponName, "weapon_rifle_ak47"))        SetEntData(client, ammoOffset + 12, your_ammo);
  48.                     else if (StrEqual(sWeaponName, "weapon_rifle_desert"))      SetEntData(client, ammoOffset + 12, your_ammo);
  49.                     else if (StrEqual(sWeaponName, "weapon_rifle_m60"))     SetEntData(client, ammoOffset + 12, your_ammo);
  50.                     else if (StrEqual(sWeaponName, "weapon_smg"))           SetEntData(client, ammoOffset + 20, your_ammo);
  51.                     else if (StrEqual(sWeaponName, "weapon_smg_silenced"))      SetEntData(client, ammoOffset + 20, your_ammo);
  52.                     else if (StrEqual(sWeaponName, "weapon_pumpshotgun"))       SetEntData(client, ammoOffset + 28, your_ammo);
  53.                     else if (StrEqual(sWeaponName, "weapon_shotgun_chrome"))    SetEntData(client, ammoOffset + 28, your_ammo);
  54.                     else if (StrEqual(sWeaponName, "weapon_autoshotgun"))       SetEntData(client, ammoOffset + 32, your_ammo);
  55.                     else if (StrEqual(sWeaponName, "weapon_shotgun_spas"))      SetEntData(client, ammoOffset + 32, your_ammo);
  56.                     else if (StrEqual(sWeaponName, "weapon_hunting_rifle"))     SetEntData(client, ammoOffset + 36, your_ammo);
  57.                     else if (StrEqual(sWeaponName, "weapon_sniper_military"))   SetEntData(client, ammoOffset + 40, your_ammo);
  58.                     else if (StrEqual(sWeaponName, "weapon_grenade_launcher"))  SetEntData(client, ammoOffset + 68, your_ammo);
  59.                     else if (StrEqual(sWeaponName, "weapon_rifle_sg552"))       SetEntData(client, ammoOffset + 12, your_ammo);
  60.                     else if (StrEqual(sWeaponName, "weapon_smg_mp5"))       SetEntData(client, ammoOffset + 20, your_ammo);
  61.                     else if (StrEqual(sWeaponName, "weapon_sniper_awp"))        SetEntData(client, ammoOffset + 40, your_ammo);
  62.                     else if (StrEqual(sWeaponName, "weapon_sniper_scout"))      SetEntData(client, ammoOffset + 40, your_ammo);
  63.                 }
  64.             }
  65.         }
  66.     }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement