mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 10:28:26 +00:00
85 lines
1.7 KiB
SourcePawn
85 lines
1.7 KiB
SourcePawn
|
|
#if defined _shavit_weapon_stocks_included
|
|
#endinput
|
|
#endif
|
|
#define _shavit_weapon_stocks_included
|
|
|
|
stock int GiveSkinnedWeapon(int client, const char[] classname)
|
|
{
|
|
int target_team = 0;
|
|
int current_team = 0;
|
|
|
|
if (StrContains(classname, "usp") != -1)
|
|
{
|
|
target_team = 3;
|
|
}
|
|
else if (StrContains(classname, "glock") != -1)
|
|
{
|
|
target_team = 2;
|
|
}
|
|
|
|
if (target_team != 0)
|
|
{
|
|
current_team = GetEntProp(client, Prop_Send, "m_iTeamNum");
|
|
|
|
if (current_team != target_team)
|
|
{
|
|
SetEntProp(client, Prop_Send, "m_iTeamNum", target_team);
|
|
}
|
|
}
|
|
|
|
int weapon = GivePlayerItem(client, classname);
|
|
|
|
if (current_team != target_team)
|
|
{
|
|
SetEntProp(client, Prop_Send, "m_iTeamNum", current_team);
|
|
}
|
|
|
|
return weapon;
|
|
}
|
|
|
|
stock void RemoveAllWeapons(int client)
|
|
{
|
|
int weapon = -1, max = GetEntPropArraySize(client, Prop_Send, "m_hMyWeapons");
|
|
for (int i = 0; i < max; i++)
|
|
{
|
|
if ((weapon = GetEntPropEnt(client, Prop_Send, "m_hMyWeapons", i)) == -1)
|
|
continue;
|
|
|
|
if (RemovePlayerItem(client, weapon))
|
|
{
|
|
AcceptEntityInput(weapon, "Kill");
|
|
}
|
|
}
|
|
}
|
|
|
|
stock void SetMaxWeaponAmmo(int client, int weapon, bool setClip1)
|
|
{
|
|
static EngineVersion engine = Engine_Unknown;
|
|
|
|
if (engine == Engine_Unknown)
|
|
{
|
|
engine = GetEngineVersion();
|
|
}
|
|
|
|
int iAmmo = GetEntProp(weapon, Prop_Send, "m_iPrimaryAmmoType");
|
|
SetEntProp(client, Prop_Send, "m_iAmmo", 255, 4, iAmmo);
|
|
|
|
if (engine == Engine_CSGO)
|
|
{
|
|
SetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", 255);
|
|
}
|
|
|
|
if (setClip1)
|
|
{
|
|
int amount = GetEntProp(weapon, Prop_Send, "m_iClip1") + 1;
|
|
|
|
if (HasEntProp(weapon, Prop_Send, "m_bBurstMode") && GetEntProp(weapon, Prop_Send, "m_bBurstMode"))
|
|
{
|
|
amount += 2;
|
|
}
|
|
|
|
SetEntProp(weapon, Prop_Data, "m_iClip1", amount);
|
|
}
|
|
}
|