Is it ok to do this when checking if they got enough funds in dialogs? - 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: Is it ok to do this when checking if they got enough funds in dialogs? (
/showthread.php?tid=403575)
Is it ok to do this when checking if they got enough funds in dialogs? -
101 - 30.12.2012
pawn Код:
if(listitem == 1)
{
if(GetPlayerMoney(playerid) < 2000000) return SendClientMessage(playerid, COLOR_RED, "Insufficient funds.");
SetVehicleHealth(vid, 1000);
RepairVehicle(vid)
}
A friend told me in the past that I should do this, do I have to do it like this? or the up example is ok too?
pawn Код:
if(listitem == 1)
{
if(GetPlayerMoney(playerid) >= 2000000)
{
SetVehicleHealth(vid, 1000);
RepairVehicle(vid);
}
else
{
SendClientMessage(playerid, COLOR_RED,"Insufficient funds.");
}
}
Re: Is it ok to do this when checking if they got enough funds in dialogs? -
Chriham3 - 30.12.2012
That's totally fine.
Re: Is it ok to do this when checking if they got enough funds in dialogs? -
Tamer - 30.12.2012
I rather the first code you posted and I use that one on my script.
Ps. Hi 101. Haha.
Re: Is it ok to do this when checking if they got enough funds in dialogs? -
Konstantinos - 30.12.2012
RepairVehicle functions sets the vehicle health to max and it repairs the doors/windows/body etc. So, it's pointless to use the SetVehicleHealth function.
Just use
pawn Код:
if(listitem == 1)
{
// vid should be equal to "GetPlayerVehicleID(playerid);"
if(GetPlayerMoney(playerid) < 2000000) return SendClientMessage(playerid, COLOR_RED, "Insufficient funds.");
RepairVehicle(vid)
}