fixing buying one projectile not removing other projectile
This commit is contained in:
parent
8455a1a231
commit
ae8135d160
@ -5,6 +5,9 @@
|
|||||||
#define g_dLength 256
|
#define g_dLength 256
|
||||||
#define CSGO_KNOCKBACK_BOOST 251.0
|
#define CSGO_KNOCKBACK_BOOST 251.0
|
||||||
#define CSGO_KNOCKBACK_BOOST_MAX 350.0
|
#define CSGO_KNOCKBACK_BOOST_MAX 350.0
|
||||||
|
#define HEGrenadeOffset 11 // (11 * 4)
|
||||||
|
#define FlashbangOffset 12 // (12 * 4)
|
||||||
|
#define SmokegrenadeOffset 13 // (13 * 4)
|
||||||
#include <sourcemod>
|
#include <sourcemod>
|
||||||
#include <sdktools>
|
#include <sdktools>
|
||||||
#include <cstrike>
|
#include <cstrike>
|
||||||
@ -585,6 +588,22 @@ public int Zclass_Menu(Menu menu, MenuAction action, int client, int selection)
|
|||||||
}
|
}
|
||||||
return 0;
|
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
|
// Purpose: //https://forums.alliedmods.net/showthread.php?t=305092
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -609,15 +628,34 @@ public void ZmarketGetWeapon(int client, int index)
|
|||||||
}
|
}
|
||||||
GetClientAbsOrigin(client, l_fClientPos);
|
GetClientAbsOrigin(client, l_fClientPos);
|
||||||
l_iWeapon = GetPlayerWeaponSlot(client, g_iWeaponSlot[index]);
|
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 (IsValidEntity(l_iWeapon))
|
||||||
{
|
{
|
||||||
if (GetEntPropEnt(l_iWeapon, Prop_Send, "m_hOwnerEntity") != client)
|
if (GetEntPropEnt(l_iWeapon, Prop_Send, "m_hOwnerEntity") != client)
|
||||||
{
|
{
|
||||||
SetEntPropEnt(l_iWeapon, Prop_Send, "m_hOwnerEntity", client);
|
SetEntPropEnt(l_iWeapon, Prop_Send, "m_hOwnerEntity", client);
|
||||||
}
|
}
|
||||||
|
if (g_iWeaponSlot[index] != 3)
|
||||||
|
{
|
||||||
CS_DropWeapon(client, l_iWeapon, false, true);
|
CS_DropWeapon(client, l_iWeapon, false, true);
|
||||||
AcceptEntityInput(l_iWeapon, "Kill");
|
AcceptEntityInput(l_iWeapon, "Kill");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
TeleportEntity(l_iEntity, l_fClientPos, NULL_VECTOR, NULL_VECTOR);
|
TeleportEntity(l_iEntity, l_fClientPos, NULL_VECTOR, NULL_VECTOR);
|
||||||
DispatchKeyValueInt(l_iEntity, "ammo", 4500);
|
DispatchKeyValueInt(l_iEntity, "ammo", 4500);
|
||||||
DispatchSpawn(l_iEntity);
|
DispatchSpawn(l_iEntity);
|
||||||
|
Loading…
Reference in New Issue
Block a user