Quick question about checking players money
#1

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.
Reply
#2

Код:
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
Reply
#3

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.
Reply
#4

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)