[HELP] tracking players
#1

I added a /buydeagle command

Код:
    
if (strcmp(cmdtext, "/buyarmour", true) == 0)
{
SetPlayerArmour(playerid, 100);
SendClientMessage(playerid, COLOR_GREEN, "You have full armor now");
GivePlayerMoney(playerid, -1000);
return 1;
}
But then when I use it in game if I had 500$ it will bring me to -500$.
How do I add something that would check if he has the money.
Reply
#2

Just add:

pawn Код:
if(GetPlayerMoney(playerid) < The amount of cash needed to buy the thing)return SendClientMessage(playerid,-1,"You need x amount of money to buy this.");
Before you give them the guns just add that there. Like at SetPlayerArmour(playerid,100); add that check in the line before that.

Example:

pawn Код:
if(GetPlayerMoney(playerid) < 500)return SendClientMessage(playerid,-1,"You need $500 to buy this.");
Oh and -1 would set the color to white.
Reply
#3

Thanks it works perfectly.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)