Command?
#1

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

return 1; after the error message to stop the script there.
Reply
#3

PHP код:
if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playeridCOLOR_WHITE"You don't have money!");
    if(
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridCOLOR_WHITE"You are not in vehicle");
    
RepairVehicle(GetPlayerVehicleID(playerid));
    
GivePlayerMoney(playerid, -500);
    
SendClientMessage(playeridCOLOR_WHITE"You successfully repaired your vehicle, and this costs you $500"); 
here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)