SA-MP Forums Archive
[Request]Repair CMD - 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: [Request]Repair CMD (/showthread.php?tid=604038)



[Request]Repair CMD - ArianGubetini - 30.03.2016

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


Re: [Request]Repair CMD - Konstantinos - 30.03.2016

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.


Re: [Request]Repair CMD - ArianGubetini - 30.03.2016

Alright thanks.
+1 rep


Re: [Request]Repair CMD - ArianGubetini - 01.04.2016

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?


Re: [Request]Repair CMD - jlalt - 01.04.2016

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;




Re: [Request]Repair CMD - ArianGubetini - 01.04.2016

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


Re: [Request]Repair CMD - MattMaximum - 01.04.2016

Код:
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;
	}