hello everyone , i have maked this code to contorle the ammo of this weapon by cvar but no result
when i do this: i have unlimeted ammo
Code:
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
/////other cvars
cvar_bullets = register_cvar("m4_bullets", "150")
}
////////Others codes////////
new money = cs_get_user_money(id)
if (money >= get_pcvar_num(cvar_cost) && get_pcvar_num(cvar_bullets))
{
cs_set_user_money(id, money - get_pcvar_num(cvar_cost))
give_item(id, "weapon_m4a1")
give_item(id, "ammo_556nato")
cs_set_user_bpammo(id, CSW_M4A1, (cvar_bullets))
g_HasM4[id] = true
}
but when i do this: i have 150 ammmo
Code:
////////Others codes////////
if (money >= get_pcvar_num(cvar_cost))
{
cs_set_user_money(id, money - get_pcvar_num(cvar_cost))
give_item(id, "weapon_m4a1")
give_item(id, "ammo_556nato")
cs_set_user_bpammo(id, CSW_M4A1, 150)
g_HasM4[id] = true
}
why the cavr don't work
??