30.03.2016, 21:28
Hello.I need an admin repair cmd to repair any specific vehicle(not only when im in that vehicle ).Ex./repair(vehicle id).
Thanks
Thanks
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;
}
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?
|
native IsValidVehicle(vehicleid);
CMD:repair(playerid, params[]) {
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;
}
PHP код:
|
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; }