SA-MP Forums Archive
Quick question about checking players money - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Quick question about checking players money (/showthread.php?tid=606365)



Quick question about checking players money - ImToro - 03.05.2016

So I've built a script that takes money from the player and gives them ammo for their "paintballgun".

Код:
SendClientMessage(playerid, White, "You have purchaused a Paint Rifle AMMO for $175");
GivePlayerMoney(playerid, -175);
new ammo;
ammo = GetPlayerAmmo(playerid);
SetPlayerAmmo(playerid, 33, ammo+25);
Basically how would i write out an if statement to put at the front of this part of code to make sure they have the correct amount of money to be able to purchase this item?

This is what i was thinking but I don't know what I should put there instead of "=="
Код:
if(GetPlayerMoney == 175)
SendClientMessage(playerid, White, "You have purchaused a Paint Rifle AMMO for $175");
GivePlayerMoney(playerid, -175);
new ammo;
ammo = GetPlayerAmmo(playerid);
SetPlayerAmmo(playerid, 33, ammo+25);
I'd of course ad more for "if else' but I'm just confused about the first part of the checking the players money.

Cheers for any help.


Re: Quick question about checking players money - cdoubleoper - 03.05.2016

Код:
if(GetPlayerMoney(playerid) >= 175){} //If the player has got the amount equal to 175 or bigger the code is going to response.
Код:
== equals to x
>= equals or greater than x
<= equals or  smaller than x
!= doesn't equal to x



Re: Quick question about checking players money - ImToro - 03.05.2016

Thanks, Could you provide me with all of them things for future reference?

Like the >= and == As i can't figure out what to search for them.


Re: Quick question about checking players money - cdoubleoper - 03.05.2016

There you go, I've edited my first post in this topic.


Re: Quick question about checking players money - Vince - 03.05.2016

https://sampwiki.blast.hk/wiki/Control_Structures
And also page 105 of the manual: https://pawnscript.******code.com/sv.../pawn-lang.pdf