Quote:
Originally Posted by ConnorMcLeod
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(id, i_Item)
{
if(user_has_weapon(id, i_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+1 <= MAXGRENADES) Exapmle 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(id, CHAN_WEAPON , "items/9mmclip1.wav" , 1.0 , ATTN_NORM , 0 , 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
}