There are a few things wrong with this code.
a)
Code:
if (PlayerXP[id] > get_cvar_num("ammo_cost"))
This should be >= -- after all, if something costs 200 dollars and you have 200 dollars you should be able to buy it instead of requiring 201 dollars.
b)
Code:
PlayerXP[id] - get_cvar_num("ammo_cost")
As pointed out, this should be -= -- that actually assigns a value instead of returning one. Currently it would be like having a line that reads "4;", it doesn't do anything.
c)
Code:
if (PlayerXP[id] > get_cvar_num("ammo_cost"))
PlayerXP[id] - get_cvar_num("ammo_cost")
ammo[id]=true
While technically at this point the user should be cleared for buying ammo, the ammo[id]=true statement should be included in your if statement. Or, just remove the if statement entirely.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS