Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include sdktools
- #include sdkhooks
- #pragma semicolon 1
- #pragma newdecls required
- bool IsUsed[2048+1] = false;
- static int ammoOffset;
- public void OnMapStart()
- {
- for(int i = 33; i <= 2048; ++i)
- {
- IsUsed[i] = false;
- }
- }
- public void OnPluginStart()
- {
- ammoOffset = FindSendPropInfo("CTerrorPlayer", "m_iAmmo");
- }
- public void OnEntityCreated(int entity, const char[] classname)
- {
- IsUsed[entity] = false;
- }
- public void OnClientPutInServer(int client)
- {
- SDKHook(client, SDKHook_WeaponEquip, WeaponEquip);
- }
- public void OnClientDisconnect(int client)
- {
- SDKUnhook(client, SDKHook_WeaponEquip, WeaponEquip);
- }
- public Action WeaponEquip(int client, int weapon)
- {
- if(IsClientInGame(client) && GetClientTeam(client) == 2)
- {
- if(!IsUsed[weapon])
- {
- IsUsed[weapon] = true;
- 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