money problem
#1

i have a money problem in my server as soon as someone buys something which causes them to lose money it keep going through in red and minus how to make it so they cant buy something if they dont have the right amount?
Reply
#2

You need to use this 'if' statement
pawn Код:
if (GetPlayerMoney(playerid) < AMMOUNT_HERE)
{
    // they don't have the money
}
else
{
    // they have the money
}
Reply
#3

im sorry im quite new could anyone fit it into one of cmds so i know how it works

Код:
if (strcmp("/b1", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid, 0xF5DEB3AA, "You Have Bought Brass Knuckles for $1");         //knuckles
		GivePlayerWeapon(playerid,1,1);
		GivePlayerMoney(playerid, -1);
  		return 1;
	}
Reply
#4

pawn Код:
if (strcmp("/b1", cmdtext, true, 10) == 0)
{
    if (GetPlayerMoney(playerid) < 1)
    {
        SendClientMessage(playerid, 0xF5DEB3AA, "You dont have money to buy this");
        return 1;
    }
    else
    {
        SendClientMessage(playerid, 0xF5DEB3AA, "You Have Bought Brass Knuckles for $1")
        GivePlayerWeapon(playerid,1,1);
        GivePlayerMoney(playerid, -1);
    }
    return 1;
}
Reply
#5

thanks alot now i know how to use it and it has given a boost to my gamemode thanks again
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)