mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 18:38:26 +00:00
move some weapon stocks to another file
This commit is contained in:
parent
5d26e76ec2
commit
f724863bc7
@ -0,0 +1,45 @@
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -37,6 +37,7 @@
|
||||
#include <eventqueuefix>
|
||||
|
||||
#include <shavit/physicsuntouch>
|
||||
#include <shavit/guns.sp>
|
||||
|
||||
#pragma newdecls required
|
||||
#pragma semicolon 1
|
||||
@ -1261,21 +1262,6 @@ public void OnClientPutInServer(int client)
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClientDisconnect(int client)
|
||||
{
|
||||
if(gCV_NoWeaponDrops.BoolValue)
|
||||
@ -1713,35 +1699,12 @@ public Action Command_Weapon(int client, int args)
|
||||
|
||||
if(iSlot != CS_SLOT_KNIFE)
|
||||
{
|
||||
SetWeaponAmmo(client, iWeapon, false);
|
||||
SetMaxWeaponAmmo(client, iWeapon, false);
|
||||
}
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
void SetWeaponAmmo(int client, int weapon, bool setClip1)
|
||||
{
|
||||
int iAmmo = GetEntProp(weapon, Prop_Send, "m_iPrimaryAmmoType");
|
||||
SetEntProp(client, Prop_Send, "m_iAmmo", 255, 4, iAmmo);
|
||||
|
||||
if(gEV_Type == Engine_CSGO)
|
||||
{
|
||||
SetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", 255);
|
||||
}
|
||||
|
||||
if (gCV_WeaponCommands.IntValue >= 3 && 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);
|
||||
}
|
||||
}
|
||||
|
||||
bool CanSegment(int client)
|
||||
{
|
||||
return StrContains(gS_StyleStrings[gI_Style[client]].sSpecialString, "segments") != -1;
|
||||
@ -2275,7 +2238,7 @@ public void Weapon_Fire(Event event, const char[] name, bool dB)
|
||||
if(StrContains(sWeapon, "usp") != -1 || StrContains(sWeapon, "hpk") != -1 || StrContains(sWeapon, "glock") != -1)
|
||||
{
|
||||
int client = GetClientOfUserId(event.GetInt("userid"));
|
||||
SetWeaponAmmo(client, GetEntPropEnt(client, Prop_Data, "m_hActiveWeapon"), true);
|
||||
SetMaxWeaponAmmo(client, GetEntPropEnt(client, Prop_Data, "m_hActiveWeapon"), gCV_WeaponCommands.IntValue >= 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
|
||||
#include <shavit/replay-stocks>
|
||||
#include <shavit/replay-file>
|
||||
#include <shavit/guns.sp>
|
||||
|
||||
#undef REQUIRE_EXTENSIONS
|
||||
#include <cstrike>
|
||||
@ -2148,21 +2149,6 @@ void SpectateMyBot(int serial)
|
||||
SetEntPropEnt(starter, Prop_Send, "m_hObserverTarget", bot);
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Frame_UpdateReplayClient(int serial)
|
||||
{
|
||||
int client = GetClientFromSerial(serial);
|
||||
@ -2225,18 +2211,17 @@ void UpdateReplayClient(int client)
|
||||
|
||||
if(gEV_Type != Engine_TF2 && strlen(sWeapon) > 0)
|
||||
{
|
||||
int iWeapon = GetEntPropEnt(client, Prop_Data, "m_hActiveWeapon");
|
||||
|
||||
if(StrEqual(sWeapon, "none"))
|
||||
{
|
||||
RemoveAllWeapons(client);
|
||||
}
|
||||
else
|
||||
{
|
||||
char sClassname[32];
|
||||
int iWeapon = GetEntPropEnt(client, Prop_Data, "m_hActiveWeapon");
|
||||
|
||||
if(iWeapon != -1 && IsValidEntity(iWeapon))
|
||||
{
|
||||
char sClassname[32];
|
||||
GetEntityClassname(iWeapon, sClassname, 32);
|
||||
|
||||
bool same_thing = false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user