Command? - 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: Command? (
/showthread.php?tid=661054)
Command? -
zepfiz - 20.11.2018
Okay i maked my command so if you dont have 500 money you can't fix your vehicle.
But when i use the command, it sends the message that you dont have money, but still fix the vehicle and gets the player money. How to fix it?
Here's the code:
Код:
if(GetPlayerMoney(playerid) < 500)
{
SendClientMessage(playerid, COLOR_WHITE, "You don't have money!");
}
if(IsPlayerInAnyVehicle(playerid))
{
RepairVehicle(GetPlayerVehicleID(playerid));
GivePlayerMoney(playerid, -500);
SendClientMessage(playerid, COLOR_WHITE, "You successfully repaired your vehicle, and this costs you $500");
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You are not in vehicle");
}
Re: Command? -
TheToretto - 20.11.2018
return 1; after the error message to stop the script there.
Re: Command? -
CaptainBoi - 21.11.2018
PHP код:
if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, COLOR_WHITE, "You don't have money!");
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "You are not in vehicle");
RepairVehicle(GetPlayerVehicleID(playerid));
GivePlayerMoney(playerid, -500);
SendClientMessage(playerid, COLOR_WHITE, "You successfully repaired your vehicle, and this costs you $500");
here.