Raised This Month: $ Target: $400
 0% 

getting weapons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 04-22-2007 , 09:08   Re: getting weapons
Reply With Quote #1

I think you should use a bool with that you can trace if the player have already a nade ;)

try this:
Code:
public cmd_ammoh (id)
{
    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 multi = get_pcvar_num ( g_multi )
    new bool:haveOne

    new weapons[32] 
    new num, weapon
    
    get_user_weapons(id, weapons, num)
    for(new i = 0; i < num; i++)
    {
        weapon = weapons[i];
        
        if ( weapon == CSW_HEGRENADE )
        {
            client_print ( id , print_chat , "[AmxX] You already own one," )
            haveOne = true
        }
    }
    if ((money < ( multi * g_he_nade )) && (!haveOne))
    {
        client_print ( id , print_chat , "[AmxX] You do not have enough money." )
    }
    else if(!haveOne)
    {
        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
}
__________________
regalis is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:54.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode