Raised This Month: $ Target: $400
 0% 

Hook/Block grenade buy.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
FromTheFuture
Senior Member
Join Date: Jan 2013
Old 04-28-2013 , 17:14   Re: Hook/Block grenade buy.
Reply With Quote #3

Quote:
Originally Posted by ConnorMcLeod View Post
I remember in a request i made, i used client_buy forward, and procedeed in plugin the money and give item.
Also, if player has already 1 HE or 2 Flash, you can use this :
...
I can't use this (if u give this code for using with cl_buy) because client_buy forward not be called if I will have more than one grenade.
PHP Code:
public client_buy(idi_Item)
{
    if(
user_has_weapon(idi_Item)) 
    return 
0;
    
    switch(
i_Item)
{
    case 
CSW_HEGRENADE:
    {        
    new 
ammo cs_get_user_bpammo(id,CSW_HEGRENADE)
    new 
money cs_get_user_money(id)

    if (
ammo+<= MAXGRENADESExapmle 2<=3
    
{
        
        if (
money>=300)
        {
            
            if (
g_CanBuy//Check on mp_buytime
            
{
                
give_item(id,"weapon_hegrenade")
                
cs_set_user_money(id,money-300)
                if (
ammo>=1)
                
//force_pick(id,CSA_HEGRENADE)
                
cs_set_user_bpammo(id,CSW_HEGRENADE,ammo+1)
                
emit_sound(idCHAN_WEAPON "items/9mmclip1.wav" 1.0 ATTN_NORM PITCH_NORM)
            }
            else
            {
                
client_print(id,print_center"You can't buy anything now!")
            }
            
        }
        else
        {
            
client_print(id,print_center,"You have insufficient funds!")
        }
        
    }
    else
    {
        
client_print(id,print_center,"You can't carry anymore!")// When I have 1 grenade I don's see this, I see "CANNOT carry anymore". It's mean this forward not be called or I don't know..
    
}
    
    return 
PLUGIN_HANDLED
                
    
}
}
    
cs_set_user_menu(id,0);
    return 
PLUGIN_CONTINUE

FromTheFuture is offline
 



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 10:54.


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