SA-MP Forums Archive
money problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: money problem (/showthread.php?tid=250340)



money problem - muhib777 - 22.04.2011

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?


Re: money problem - admantis - 22.04.2011

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



Re: money problem - muhib777 - 22.04.2011

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;
	}



Re: money problem - admantis - 23.04.2011

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;
}



Re: money problem - muhib777 - 23.04.2011

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