PHP Code:
if ( !get_pcvar_num ( g_switch ) )
return PLUGIN_HANDLED
if ( !get_pcvar_num ( g_grenade ) )
{
client_print( id , print_chat , "[AmxX] Currently unable to purchase grenades." )
}
if ( !is_user_alive (id) || !is_user_connected (id) )
{
client_print (id , print_chat , "[AmxX] Unable to buy HE-Grenade due to your status (Dead)." )
}
new money = cs_get_user_money (id)
new clip , ammo , weapon = get_user_weapon ( id , clip , ammo )
new multi = get_pcvar_num ( g_multi )
if ( weapon == CSW_HEGRENADE )
{
client_print ( id , print_chat , "[AmxX] You already own one," )
}
else if ( money < ( multi * g_he_nade ) )
{
client_print ( id , print_chat , "[AmxX] You do not have enough money." )
}
else
{
give_item (id , "weapon_hegrenade" )
cs_set_user_money ( id , money - ( multi * g_he_nade ) )
client_print ( id , print_chat , "[AmxX] Thank you for using Emergency Ammo!" )
}
return PLUGIN_HANDLED
}
I'm trying to check if the player has a HE or not. The problem is that get_user_weapon only works if the player is actually holding a HE in his hands.
For eg
I try to buy a HE buy with the script above (type /ammoh) and I'm holding a USP but I already have a HE. It still gives me a HE even though I'm maxed out on it. I want something to check the whole player if he has a weapon or not CARRYING it not currently HOLDING it.
__________________