SA-MP Forums Archive
Please help me - 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: Please help me (/showthread.php?tid=493224)



Please help me - MTiFa - 07.02.2014

I need the code to remove the - sign of the money under your health bar.. by this i mean that when anybody buys something it will make his money by -(money), i just want to set the money to 0 and never get under the - sign, beacause everybody though will buy anything and won't have for it but will get it and thanks


Re: Please help me - BullseyeHawk - 07.02.2014

Well, insted of making a new timer and all, for this simple thing. I would just show you how to do it.
pawn Код:
// on OnPlayerUpdate(playerid)
public OnPlayerUpdate(playerid)
{
    if(GetPlayerMoney(playerid) < 0)
    {
         SetPlayerMoney(playerid, 0);
    }
    return 1;
}
If you want to make it more complex, you can make it with a timer and delay it for a bit.


Re: Please help me - Golimad - 07.02.2014

BullseyeHawk, you didn't understand him.
The script should be like that.

pawn Код:
if (Getplayermoney(playerid) < "Price of thing he would buy") return SendClientMessage(playerid, 0xCC0000FF, "You don't have enough money to buy that thing..");
else
{
       Giveplayermoney(playerid, -"Price of thing he would buy" )
       SendClientMessage(playerid, 0xCC0000FF, "you bought that thing.");
}
Something like that, just edit the value and those messages and try it


Re: Please help me - MTiFa - 07.02.2014

Quote:
Originally Posted by Golimad
Посмотреть сообщение
BullseyeHawk, you didn't understand him.
The script should be like that.

pawn Код:
if (Getplayermoney(playerid) < "Price of thing he would buy") return SendClientMessage(playerid, 0xCC0000FF, "You don't have enough money to buy that thing..");
else
{
       Giveplayermoney(playerid, -"Price of thing he would buy" )
       SendClientMessage(playerid, 0xCC0000FF, "you bought that thing.");
}
Something like that, just edit the value and those messages and try it
Thanks alot thats what i meant


Re: Please help me - MTiFa - 07.02.2014

Quote:
Originally Posted by BullseyeHawk
Посмотреть сообщение
Well, insted of making a new timer and all, for this simple thing. I would just show you how to do it.
pawn Код:
// on OnPlayerUpdate(playerid)
public OnPlayerUpdate(playerid)
{
    if(GetPlayerMoney(playerid) < 0)
    {
         SetPlayerMoney(playerid, 0);
    }
    return 1;
}
If you want to make it more complex, you can make it with a timer and delay it for a bit.