If player money is lower then ...
#1

Hey guys i got this command and i want players that have less then $175 not be able to do it..... But how?
Reply
#2

Post the command too.
Reply
#3

if(GetPlayerMoney(playerid) >=175)
{
Can buy
}
else
{
//Cannot buy
}
Reply
#4

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
}
Reply
#5

pawn Код:
new money = GetPlayerMoney(playerid);
if (money >= 175)
{
     // able to do it
}
Reply
#6

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)