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;
- 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 weapon)
- {
- if((weapon = EntRefToEntIndex(weapon)) != INVALID_ENT_REFERENCE)
- {
- SDKHook(weapon, SDKHook_SpawnPost, SpawnPost);
- int iType = GetiAmmoType(weapon);
- if(iType != 0)
- {
- for (int client = 1; client <= 32; client++)
- {
- if(bIsSurvivor(client))
- {
- char sWeaponName[32];
- GetEdictClassname(weapon, sWeaponName, sizeof(sWeaponName));
- if (StrEqual(sWeaponName, "weapon_rifle"))
- {
- SetEntData(client, ammoOffset + 12, 0);
- SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 50), 1);
- }
- else if (StrEqual(sWeaponName, "weapon_rifle_ak47"))
- {
- SetEntData(client, ammoOffset + 12, 0);
- SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 40), 1);
- }
- else if (StrEqual(sWeaponName, "weapon_rifle_desert"))
- {
- SetEntData(client, ammoOffset + 12, 0);
- SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 60), 1);
- }
- else if (StrEqual(sWeaponName, "weapon_rifle_m60"))
- {
- SetEntData(client, ammoOffset + 12, 0);
- SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 100), 1);
- }
- else if (StrEqual(sWeaponName, "weapon_smg"))
- {
- SetEntData(client, ammoOffset + 20, 0);
- SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 50), 1);
- }
- else if (StrEqual(sWeaponName, "weapon_smg_silenced"))
- {
- SetEntData(client, ammoOffset + 20, 0);
- SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 50), 1);
- }
- else if (StrEqual(sWeaponName, "weapon_pumpshotgun"))
- {
- SetEntData(client, ammoOffset + 28, 0);
- SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 8), 1);
- }
- else if (StrEqual(sWeaponName, "weapon_shotgun_chrome"))
- {
- SetEntData(client, ammoOffset + 28, 0);
- SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 8), 1);
- }
- else if (StrEqual(sWeaponName, "weapon_autoshotgun"))
- {
- SetEntData(client, ammoOffset + 32, 0);
- SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 10), 1);
- }
- else if (StrEqual(sWeaponName, "weapon_shotgun_spas"))
- {
- SetEntData(client, ammoOffset + 32, 0);
- SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 10), 1);
- }
- else if (StrEqual(sWeaponName, "weapon_hunting_rifle"))
- {
- SetEntData(client, ammoOffset + 36, 0);
- SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 15), 1);
- }
- else if (StrEqual(sWeaponName, "weapon_sniper_military"))
- {
- SetEntData(client, ammoOffset + 40, 0);
- SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 30), 1);
- }
- else if (StrEqual(sWeaponName, "weapon_grenade_launcher"))
- {
- SetEntData(client, ammoOffset + 68, 0);
- SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 1), 1);
- }
- else if (StrEqual(sWeaponName, "weapon_rifle_sg552"))
- {
- SetEntData(client, ammoOffset + 12, 0);
- SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 50), 1);
- }
- else if (StrEqual(sWeaponName, "weapon_smg_mp5"))
- {
- SetEntData(client, ammoOffset + 20, 0);
- SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 50), 1);
- }
- else if (StrEqual(sWeaponName, "weapon_sniper_awp"))
- {
- SetEntData(client, ammoOffset + 40, 0);
- SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 20), 1);
- }
- else if (StrEqual(sWeaponName, "weapon_sniper_scout"))
- {
- SetEntData(client, ammoOffset + 40, 0);
- SetEntProp(weapon, Prop_Send, "m_iClip1", GetRandomInt(0, 15), 1);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment