Is it ok to do this when checking if they got enough funds in dialogs?
#1

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.");
}
}
Reply
#2

That's totally fine.
Reply
#3

I rather the first code you posted and I use that one on my script.

Ps. Hi 101. Haha.
Reply
#4

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)
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)