Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #include <sdkhooks>
- #include <iAmmo.CoreClude>
- #pragma semicolon 1
- #pragma newdecls required
- static int ammoOffset;
- static int your_ammo = 0;
- public void OnPluginStart()
- {
- ammoOffset = FindSendPropInfo("CTerrorPlayer", "m_iAmmo");
- }
- public void OnEntityCreated(int entity, const char[] classname)
- {
- if (IsValidEdict(entity))
- {
- SDKHook(entity, SDKHook_SpawnPost, SpawnPost);
- }
- }
- public void SpawnPost(int entity)
- {
- RequestFrame(nextFrame, EntIndexToEntRef(entity));
- }
- public void nextFrame(int entity)
- {
- if((entity = EntRefToEntIndex(entity)) != INVALID_ENT_REFERENCE)
- {
- SDKHook(entity, SDKHook_SpawnPost, SpawnPost);
- int iType = GetiAmmoType(entity);
- if(iType != 0)
- {
- for (int client = 1; client <= 32; client++)
- {
- if(bIsSurvivor(client))
- {
- char sWeaponName[32];
- GetEdictClassname(entity, sWeaponName, sizeof(sWeaponName));
- if (StrEqual(sWeaponName, "weapon_rifle")) SetEntData(client, ammoOffset + 12, your_ammo);
- else if (StrEqual(sWeaponName, "weapon_rifle_ak47")) SetEntData(client, ammoOffset + 12, your_ammo);
- else if (StrEqual(sWeaponName, "weapon_rifle_desert")) SetEntData(client, ammoOffset + 12, your_ammo);
- else if (StrEqual(sWeaponName, "weapon_rifle_m60")) SetEntData(client, ammoOffset + 12, your_ammo);
- else if (StrEqual(sWeaponName, "weapon_smg")) SetEntData(client, ammoOffset + 20, your_ammo);
- else if (StrEqual(sWeaponName, "weapon_smg_silenced")) SetEntData(client, ammoOffset + 20, your_ammo);
- else if (StrEqual(sWeaponName, "weapon_pumpshotgun")) SetEntData(client, ammoOffset + 28, your_ammo);
- else if (StrEqual(sWeaponName, "weapon_shotgun_chrome")) SetEntData(client, ammoOffset + 28, your_ammo);
- else if (StrEqual(sWeaponName, "weapon_autoshotgun")) SetEntData(client, ammoOffset + 32, your_ammo);
- else if (StrEqual(sWeaponName, "weapon_shotgun_spas")) SetEntData(client, ammoOffset + 32, your_ammo);
- else if (StrEqual(sWeaponName, "weapon_hunting_rifle")) SetEntData(client, ammoOffset + 36, your_ammo);
- else if (StrEqual(sWeaponName, "weapon_sniper_military")) SetEntData(client, ammoOffset + 40, your_ammo);
- else if (StrEqual(sWeaponName, "weapon_grenade_launcher")) SetEntData(client, ammoOffset + 68, your_ammo);
- else if (StrEqual(sWeaponName, "weapon_rifle_sg552")) SetEntData(client, ammoOffset + 12, your_ammo);
- else if (StrEqual(sWeaponName, "weapon_smg_mp5")) SetEntData(client, ammoOffset + 20, your_ammo);
- else if (StrEqual(sWeaponName, "weapon_sniper_awp")) SetEntData(client, ammoOffset + 40, your_ammo);
- else if (StrEqual(sWeaponName, "weapon_sniper_scout")) SetEntData(client, ammoOffset + 40, your_ammo);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement