05.02.2018, 08:57
Okay It's working perfectly the only problem is:
For example I have 11 points and M4 costs 10 points, I can buy it,
If I have exactly 10 points I can't buy it, If I have less that 10 too I also can't buy it
For example I have 11 points and M4 costs 10 points, I can buy it,
If I have exactly 10 points I can't buy it, If I have less that 10 too I also can't buy it
Код:
stock SellWeapon(playerid, points, weapon, ammo) { new ppoints = GetPlayerPoints(playerid); if(ppoints>points) { new string[80], weaponname[32]; GivePlayerPoints(playerid, -points); GetPlayerPoints(playerid); GivePlayerWeapon(playerid, weapon,ammo); GetWeaponName(weapon, weaponname, sizeof(weaponname)); format(string, sizeof(string), "{EFB509}(SHOP) You have bought %s with %i ammo for %i points", weaponname, ammo, points); return SendClientMessage(playerid, -1, string); } else return SendClientMessage(playerid, -1,"{FF0000}(INFO) You don't have enough points"); } forward GetPlayerPoints(playerid); public GetPlayerPoints(playerid) { return pInfo[playerid][Points]; } forward GivePlayerPoints(playerid, amount); public GivePlayerPoints(playerid,amount) { pInfo[playerid][Points]=pInfo[playerid][Points]+amount; return 1; }