[Request]Repair CMD
#1

Hello.I need an admin repair cmd to repair any specific vehicle(not only when im in that vehicle ).Ex./repair(vehicle id).
Thanks
Reply
#2

pawn Код:
CMD:repair(playerid, params[])
{
    new
        vehicleid;

    if (sscanf(params, "i", vehicleid)) return SendClientMessage(playerid, -1, "Usage: /repair <vehicleid>");
    if (!GetVehicleModel(vehicleid)) return SendClientMessage(playerid, -1, "Vehicle does not exist.");

    RepairVehicle(vehicleid);
    return 1;
}
You can add the line about admin privileges at the beginning.
Reply
#3

Alright thanks.
+1 rep
Reply
#4

I have tried this command on my script.It compiles with out errors but it does not work on game.So if you do /repair it wont fix the car.Any idea?
Reply
#5

Quote:
Originally Posted by ArianGubetini
Посмотреть сообщение
I have tried this command on my script.It compiles with out errors but it does not work on game.So if you do /repair it wont fix the car.Any idea?
PHP код:
native IsValidVehicle(vehicleid);
CMD:repair(playeridparams[])  {
   if(
isnull(params)) {
      if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"Usae: /repair [vehicleID]");
      
RepairVehicle(GetPlayerVehicleID(playerid));
      
SendClientMessage(playerid,-1,"You have sucessfully repaired your vehicle!");
   } else {
      if(
IsValidVehicle(strval(params))) {
           
RepairVehicle(strval(params));
           
SendClientMessage(playerid,-1,"You have sucessfully repaired the vehicle!");
      } else {
         
SendClientMessage(playerid,-1,"ERROR: Invalid Vehicle ID!");
      }
   }
   return 
1;

Reply
#6

Quote:
Originally Posted by jlalt
Посмотреть сообщение
PHP код:
native IsValidVehicle(vehicleid);
   if(
isnull(params)) {
      if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"Usae: /repair [vehicleID]");
      
RepairVehicle(GetPlayerVehicleID(playerid));
      
SendClientMessage(playerid,-1,"You have sucessfully repaired your vehicle!");
   } else {
      if(
IsValidVehicle(strval(params))) {
           
RepairVehicle(strval(params));
           
SendClientMessage(playerid,-1,"You have sucessfully repaired the vehicle!");
      } else {
         
SendClientMessage(playerid,-1,"ERROR: Invalid Vehicle ID!");
      }
   }
   return 
1;

Working
Thanks
+1Rep
Reply
#7

Код:
CMD:fixveh(playerid, params[])
	{
	     if(IsPlayerInAnyVehicle(playerid))
	                {
						new vehicleid = GetPlayerVehicleID(playerid);
						RepairVehicle(vehicleid);
						SendClientMessage(playerid, GREY, "You fixed your car!");
	                }
	                else
	                {
	                    SendClientMessage(playerid, GREY, "You have to be in a car to use this command!");
	                }
	        }
	    return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)