mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-09 03:18:25 +00:00
fixup some gun spawning stuff
This commit is contained in:
parent
4b4773f8a5
commit
8ce9cd97b4
@ -55,7 +55,7 @@
|
|||||||
#define HUD2_PERFS (1 << 11)
|
#define HUD2_PERFS (1 << 11)
|
||||||
#define HUD2_TOPLEFT_RANK (1 << 12)
|
#define HUD2_TOPLEFT_RANK (1 << 12)
|
||||||
#define HUD2_VELOCITYDIFFERENCE (1 << 13)
|
#define HUD2_VELOCITYDIFFERENCE (1 << 13)
|
||||||
#define HUD2_USPSILENCER (1 << 14) // spawns usps with a silencer on (only used in CSS)
|
#define HUD2_USPSILENCER (1 << 14) // spawns usps with a silencer on
|
||||||
#define HUD2_GLOCKBURST (1 << 15) // spawns glocks with burst
|
#define HUD2_GLOCKBURST (1 << 15) // spawns glocks with burst
|
||||||
|
|
||||||
#define HUD_DEFAULT (HUD_MASTER|HUD_CENTER|HUD_ZONEHUD|HUD_OBSERVE|HUD_TOPLEFT|HUD_SYNC|HUD_TIMELEFT|HUD_2DVEL|HUD_SPECTATORS)
|
#define HUD_DEFAULT (HUD_MASTER|HUD_CENTER|HUD_ZONEHUD|HUD_OBSERVE|HUD_TOPLEFT|HUD_SYNC|HUD_TIMELEFT|HUD_2DVEL|HUD_SPECTATORS)
|
||||||
|
|||||||
@ -4,6 +4,40 @@
|
|||||||
#endif
|
#endif
|
||||||
#define _shavit_weapon_stocks_included
|
#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)
|
stock void RemoveAllWeapons(int client)
|
||||||
{
|
{
|
||||||
int weapon = -1, max = GetEntPropArraySize(client, Prop_Send, "m_hMyWeapons");
|
int weapon = -1, max = GetEntPropArraySize(client, Prop_Send, "m_hMyWeapons");
|
||||||
|
|||||||
@ -28,6 +28,8 @@
|
|||||||
#include <shavit/core>
|
#include <shavit/core>
|
||||||
#include <shavit/hud>
|
#include <shavit/hud>
|
||||||
|
|
||||||
|
#include <shavit/weapon-stocks>
|
||||||
|
|
||||||
#undef REQUIRE_PLUGIN
|
#undef REQUIRE_PLUGIN
|
||||||
#include <shavit/rankings>
|
#include <shavit/rankings>
|
||||||
#include <shavit/replay-playback>
|
#include <shavit/replay-playback>
|
||||||
@ -764,10 +766,7 @@ Action ShowHUDMenu(int client, int item)
|
|||||||
FormatEx(sInfo, 16, "@%d", HUD2_GLOCKBURST);
|
FormatEx(sInfo, 16, "@%d", HUD2_GLOCKBURST);
|
||||||
FormatEx(sHudItem, 64, "%T", "HudGlockBurst", client);
|
FormatEx(sHudItem, 64, "%T", "HudGlockBurst", client);
|
||||||
menu.AddItem(sInfo, sHudItem);
|
menu.AddItem(sInfo, sHudItem);
|
||||||
}
|
|
||||||
|
|
||||||
if (gEV_Type == Engine_CSS)
|
|
||||||
{
|
|
||||||
FormatEx(sInfo, 16, "@%d", HUD2_USPSILENCER);
|
FormatEx(sInfo, 16, "@%d", HUD2_USPSILENCER);
|
||||||
FormatEx(sHudItem, 64, "%T", "HudUSPSilencer", client);
|
FormatEx(sHudItem, 64, "%T", "HudUSPSilencer", client);
|
||||||
menu.AddItem(sInfo, sHudItem);
|
menu.AddItem(sInfo, sHudItem);
|
||||||
@ -874,10 +873,24 @@ public int MenuHandler_HUD(Menu menu, MenuAction action, int param1, int param2)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_usp(int entity, const char[] classname)
|
||||||
|
{
|
||||||
|
if (gEV_Type == Engine_CSGO)
|
||||||
|
{
|
||||||
|
return (61 == GetEntProp(entity, Prop_Send, "m_iItemDefinitionIndex"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return StrEqual(classname, "weapon_usp");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void OnEntityCreated(int entity, const char[] classname)
|
public void OnEntityCreated(int entity, const char[] classname)
|
||||||
{
|
{
|
||||||
if ((gEV_Type == Engine_CSS && StrEqual(classname, "weapon_usp"))
|
if (StrEqual(classname, "weapon_glock")
|
||||||
|| (StrEqual(classname, "weapon_glock")))
|
|| StrEqual(classname, "weapon_hkp2000")
|
||||||
|
|| StrContains(classname, "weapon_usp") != -1
|
||||||
|
)
|
||||||
{
|
{
|
||||||
SDKHook(entity, SDKHook_Touch, Hook_GunTouch);
|
SDKHook(entity, SDKHook_Touch, Hook_GunTouch);
|
||||||
}
|
}
|
||||||
@ -897,11 +910,17 @@ public Action Hook_GunTouch(int entity, int client)
|
|||||||
SetEntProp(entity, Prop_Send, "m_bBurstMode", 1);
|
SetEntProp(entity, Prop_Send, "m_bBurstMode", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (gEV_Type == Engine_CSS && StrEqual(classname, "weapon_usp") && !(gI_HUD2Settings[client] & HUD2_USPSILENCER))
|
else if (is_usp(entity, classname))
|
||||||
{
|
{
|
||||||
SetEntProp(entity, Prop_Send, "m_bSilencerOn", 1);
|
if (!(gI_HUD2Settings[client] & HUD2_USPSILENCER) != (gEV_Type == Engine_CSS))
|
||||||
SetEntProp(entity, Prop_Send, "m_weaponMode", 1);
|
{
|
||||||
SetEntPropFloat(entity, Prop_Send, "m_flDoneSwitchingSilencer", GetGameTime() - 0.1);
|
return Plugin_Continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int state = (gEV_Type == Engine_CSS) ? 1 : 0;
|
||||||
|
SetEntProp(entity, Prop_Send, "m_bSilencerOn", state);
|
||||||
|
SetEntProp(entity, Prop_Send, "m_weaponMode", state);
|
||||||
|
SetEntPropFloat(entity, Prop_Send, "m_flDoneSwitchingSilencer", GetGameTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -934,7 +953,7 @@ void GivePlayerDefaultGun(int client)
|
|||||||
AcceptEntityInput(iWeapon, "Kill");
|
AcceptEntityInput(iWeapon, "Kill");
|
||||||
}
|
}
|
||||||
|
|
||||||
iWeapon = GivePlayerItem(client, sWeapon);
|
iWeapon = (gEV_Type == Engine_CSGO) ? GiveSkinnedWeapon(client, sWeapon) : GivePlayerItem(client, sWeapon);
|
||||||
FakeClientCommand(client, "use %s", sWeapon);
|
FakeClientCommand(client, "use %s", sWeapon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1676,7 +1676,7 @@ public Action Command_Weapon(int client, int args)
|
|||||||
AcceptEntityInput(iWeapon, "Kill");
|
AcceptEntityInput(iWeapon, "Kill");
|
||||||
}
|
}
|
||||||
|
|
||||||
iWeapon = GivePlayerItem(client, sWeapon);
|
iWeapon = (gEV_Type == Engine_CSGO) ? GiveSkinnedWeapon(client, sWeapon) : GivePlayerItem(client, sWeapon);
|
||||||
FakeClientCommand(client, "use %s", sWeapon);
|
FakeClientCommand(client, "use %s", sWeapon);
|
||||||
|
|
||||||
if(iSlot != CS_SLOT_KNIFE)
|
if(iSlot != CS_SLOT_KNIFE)
|
||||||
@ -2209,7 +2209,7 @@ public void Weapon_Fire(Event event, const char[] name, bool dB)
|
|||||||
char sWeapon[16];
|
char sWeapon[16];
|
||||||
event.GetString("weapon", sWeapon, 16);
|
event.GetString("weapon", sWeapon, 16);
|
||||||
|
|
||||||
if(StrContains(sWeapon, "usp") != -1 || StrContains(sWeapon, "hpk") != -1 || StrContains(sWeapon, "glock") != -1)
|
if(StrContains(sWeapon, "usp") != -1 || StrContains(sWeapon, "hkp") != -1 || StrContains(sWeapon, "glock") != -1)
|
||||||
{
|
{
|
||||||
int client = GetClientOfUserId(event.GetInt("userid"));
|
int client = GetClientOfUserId(event.GetInt("userid"));
|
||||||
SetMaxWeaponAmmo(client, GetEntPropEnt(client, Prop_Data, "m_hActiveWeapon"), gCV_WeaponCommands.IntValue >= 3);
|
SetMaxWeaponAmmo(client, GetEntPropEnt(client, Prop_Data, "m_hActiveWeapon"), gCV_WeaponCommands.IntValue >= 3);
|
||||||
|
|||||||
@ -2253,14 +2253,14 @@ void UpdateReplayClient(int client)
|
|||||||
|
|
||||||
bool same_thing = false;
|
bool same_thing = false;
|
||||||
|
|
||||||
// special case for csgo stuff because the usp classname becomes weapon_hpk2000
|
// special case for csgo stuff because the usp classname becomes weapon_hkp2000
|
||||||
if (gEV_Type == Engine_CSGO)
|
if (gEV_Type == Engine_CSGO)
|
||||||
{
|
{
|
||||||
if (StrEqual(sWeapon, "weapon_usp_silencer"))
|
if (StrEqual(sWeapon, "weapon_usp_silencer") || StrEqual(sWeapon, "weapon_usp"))
|
||||||
{
|
{
|
||||||
same_thing = (61 == GetEntProp(iWeapon, Prop_Send, "m_iItemDefinitionIndex"));
|
same_thing = (61 == GetEntProp(iWeapon, Prop_Send, "m_iItemDefinitionIndex"));
|
||||||
}
|
}
|
||||||
else if (StrEqual(sWeapon, "weapon_hpk2000"))
|
else if (StrEqual(sWeapon, "weapon_hkp2000"))
|
||||||
{
|
{
|
||||||
same_thing = (32 == GetEntProp(iWeapon, Prop_Send, "m_iItemDefinitionIndex"));
|
same_thing = (32 == GetEntProp(iWeapon, Prop_Send, "m_iItemDefinitionIndex"));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user