diff --git a/ZombieRiot/scripting/unloze_zr.sp b/ZombieRiot/scripting/unloze_zr.sp index 0f1c6e11..d0522e1a 100644 --- a/ZombieRiot/scripting/unloze_zr.sp +++ b/ZombieRiot/scripting/unloze_zr.sp @@ -5,6 +5,9 @@ #define g_dLength 256 #define CSGO_KNOCKBACK_BOOST 251.0 #define CSGO_KNOCKBACK_BOOST_MAX 350.0 +#define HEGrenadeOffset 11 // (11 * 4) +#define FlashbangOffset 12 // (12 * 4) +#define SmokegrenadeOffset 13 // (13 * 4) #include #include #include @@ -585,6 +588,22 @@ public int Zclass_Menu(Menu menu, MenuAction action, int client, int selection) } return 0; } + +int GetClientHEGrenades(int client) +{ + return GetEntProp(client, Prop_Data, "m_iAmmo", _, HEGrenadeOffset); +} + +int GetClientSmokeGrenades(int client) +{ + return GetEntProp(client, Prop_Data, "m_iAmmo", _, SmokegrenadeOffset); +} + +int GetClientFlashbangs(int client) +{ + return GetEntProp(client, Prop_Data, "m_iAmmo", _, FlashbangOffset); +} + //---------------------------------------------------------------------------------------------------- // Purpose: //https://forums.alliedmods.net/showthread.php?t=305092 //---------------------------------------------------------------------------------------------------- @@ -609,14 +628,33 @@ public void ZmarketGetWeapon(int client, int index) } GetClientAbsOrigin(client, l_fClientPos); l_iWeapon = GetPlayerWeaponSlot(client, g_iWeaponSlot[index]); + + int has_hegrenade = GetClientHEGrenades(client); + int has_smoke = GetClientSmokeGrenades(client); + int has_flashbang = GetClientFlashbangs(client); + if (StrEqual(g_cWeaponNames[index][g_iLength], "HEGrenade",false) && has_hegrenade) + { + return; + } + if (StrEqual(g_cWeaponNames[index][g_iLength], "Smokegrenade",false) && has_smoke) + { + return; + } + if (StrEqual(g_cWeaponNames[index][g_iLength], "Flashbang",false) && has_flashbang) + { + return; + } if (IsValidEntity(l_iWeapon)) { if (GetEntPropEnt(l_iWeapon, Prop_Send, "m_hOwnerEntity") != client) { SetEntPropEnt(l_iWeapon, Prop_Send, "m_hOwnerEntity", client); } - CS_DropWeapon(client, l_iWeapon, false, true); - AcceptEntityInput(l_iWeapon, "Kill"); + if (g_iWeaponSlot[index] != 3) + { + CS_DropWeapon(client, l_iWeapon, false, true); + AcceptEntityInput(l_iWeapon, "Kill"); + } } TeleportEntity(l_iEntity, l_fClientPos, NULL_VECTOR, NULL_VECTOR); DispatchKeyValueInt(l_iEntity, "ammo", 4500);