From 206cebac146ea570ddb3bcfe17fe6d64e5f65fc7 Mon Sep 17 00:00:00 2001 From: Jackz Date: Fri, 5 Jan 2024 19:47:44 -0600 Subject: [PATCH] Add includes --- scripting/include/jutils.inc | 19 +++++++++++++++++++ scripting/include/l4d2_perms.inc | 6 ++++++ 2 files changed, 25 insertions(+) create mode 100644 scripting/include/l4d2_perms.inc diff --git a/scripting/include/jutils.inc b/scripting/include/jutils.inc index 06f2e9a..2c9460a 100644 --- a/scripting/include/jutils.inc +++ b/scripting/include/jutils.inc @@ -329,6 +329,25 @@ stock int GetPrimaryAmmo(int client) { else return -1; } +stock int GetSecondaryAmmo(int client, int weapon) { + int activeWpn = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon"); + if(activeWpn == weapon) { + int offset = GetEntProp(weapon, Prop_Data, "m_iPrimaryAmmoType"); + return GetEntProp(client, Prop_Send, "m_iAmmo", _, offset); + } else { + return GetEntProp(activeWpn, Prop_Send, "m_iExtraPrimaryAmmo"); + } +} + +stock void SetSecondaryAmmo(int client, int weapon, int ammo) { + int activeWpn = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon"); + if(activeWpn == weapon) { + int offset = GetEntProp(weapon, Prop_Data, "m_iPrimaryAmmoType"); + SetEntProp(client, Prop_Send, "m_iAmmo", ammo, _, offset); + } else { + SetEntProp(activeWpn, Prop_Send, "m_iExtraPrimaryAmmo", ammo); + } +} stock void CheatCommand(int client, const char[] command, const char[] argument1, const char[] argument2) { int userFlags = GetUserFlagBits(client); SetUserFlagBits(client, ADMFLAG_ROOT); diff --git a/scripting/include/l4d2_perms.inc b/scripting/include/l4d2_perms.inc new file mode 100644 index 0000000..cb0df49 --- /dev/null +++ b/scripting/include/l4d2_perms.inc @@ -0,0 +1,6 @@ +enum ReserveMode { + Reserve_None = 0, + Reserve_Watch, + Reserve_AdminOnly, + Reserve_Private +} \ No newline at end of file