If player money is lower then ... - 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: If player money is lower then ... (
/showthread.php?tid=401665)
If player money is lower then ... -
NicholasA - 23.12.2012
Hey guys i got this command and i want players that have less then $175 not be able to do it..... But how?
Re: If player money is lower then ... -
Faisal_khan - 23.12.2012
Post the command too.
Re: If player money is lower then ... -
ikey07 - 23.12.2012
if(GetPlayerMoney(playerid) >=175)
{
Can buy
}
else
{
//Cannot buy
}
Re: If player money is lower then ... -
Lynn - 23.12.2012
Add this in your command.
Since you didn't post the command, you'll have to work it in it.
pawn Код:
new cash = GetPlayerMoney(playerid);// Gets the player cash
if(cash <= 175) // Makes sure you have 175$ or more. If this doesn't work, do >= instead.
{
SendClientMessage(playerid, 0xFFFFFF, " You do not have the funds.");// Sends the error message
return 1;
}
else // If they have the cash then....
{
// Do stuff here. Allows you to purchase the item
}
Re: If player money is lower then ... -
Universal - 23.12.2012
pawn Код:
new money = GetPlayerMoney(playerid);
if (money >= 175)
{
// able to do it
}
Re: If player money is lower then ... -
NicholasA - 23.12.2012
Quote:
Originally Posted by Lynn
Add this in your command.
Since you didn't post the command, you'll have to work it in it.
pawn Код:
new cash = GetPlayerMoney(playerid);// Gets the player cash if(cash <= 175) // Makes sure you have 175$ or more. If this doesn't work, do >= instead. { SendClientMessage(playerid, 0xFFFFFF, " You do not have the funds.");// Sends the error message return 1; } else // If they have the cash then.... { // Do stuff here. Allows you to purchase the item }
|
Thanks i got it
Re: If player money is lower then ... -
MP2 - 23.12.2012
Or to make it simpler and easier to read (reducing the likelyhood of loose indentation and missing brackets) [and also without wasting a variable for no reason]:
pawn Код:
if(GetPlayerMoney(playerid) < 175) return SendClientMessage(playerid, COLOR_RED, "You need $175.");
// Purchase here