Thread: getting weapons
View Single Post
Mini_Midget
Veteran Member
Join Date: Jan 2006
Location: It's a mystery.
Old 04-22-2007 , 08:59   Re: getting weapons
Reply With Quote #5

PHP Code:
public cmd_ammoh (id)
{
    if ( !
get_pcvar_num g_switch ) )
        return 
PLUGIN_HANDLED
    
    
if ( !get_pcvar_num g_grenade ) )  
    {
        
client_printid 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 
multi get_pcvar_num g_multi )
    
    new 
weapons[32
    new 
numweapon
    
    get_user_weapons
(idweaponsnum)
    for(new 
0numi++)
    {
        
weapon weapons[i];
        
        if ( 
weapon == CSW_HEGRENADE )
        {
            
client_print id print_chat "[AmxX] You already own one," )
        }
    }
    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 use this but it has this bug in it.

When I have a HE already. (Doesn't matter if I have it in my hands or not) and I type the command to buy. These 2 messages display.
[AmxX] You already own one!
[AmxX] Thank you for using Emergency Ammo!

AND it still charges me money even though I have one.
__________________
It's a mystery.
Mini_Midget is offline