Hey - 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: Hey (
/showthread.php?tid=647809)
Hey -
BluePlayBG - 11.01.2018
I want to create a command that repairs your vehicle, but I have issues with the timer.
PHP код:
CMD:repairmycar(playerid, params[])
{
if(!IsPlayerInAnyVehicle(playerid))
return SendErrorMessage(playerid, "You are not in a vehicle!");
if(GetPlayerState(playerid) != 2)
return SendErrorMessage(playerid, "You are not in the driver seat!");
if(IsPlayerInRangeOfPoint(playerid, 6.0, -2417.7744, 2303.7979, 1.8781))
return SendErrorMessage(playerid, "You should be in range of the point to /repairmycar !");
SendClientMessage(playerid, COLOR_WHITE, "Your vehicle will be ready in one hour (1 minute).");
GivePlayerMoney(playerid, - 200);
RepairVehicle(GetPlayerVehicleID(playerid));
return 1;
}
I need help with kicking the player out of the vehicle and make the vehicle respawn after 1 minute. Thanks in advance.
Re: Hey -
RogueDrifter - 11.01.2018
First of all to set a timer you would need
SetTimerEx second of all if you use
SetVehicleToRespawn you wont need RepairVehicle so i'm gonna go with RepairVehicle to avoid setting the vehicle's position again.
PHP код:
CMD:repairmycar(playerid, params[])
{
if(!IsPlayerInAnyVehicle(playerid))
return SendErrorMessage(playerid, "You are not in a vehicle!");
if(GetPlayerState(playerid) != 2)
return SendErrorMessage(playerid, "You are not in the driver seat!");
if(IsPlayerInRangeOfPoint(playerid, 6.0, -2417.7744, 2303.7979, 1.8781))
return SendErrorMessage(playerid, "You should be in range of the point to /repairmycar !");
SendClientMessage(playerid, COLOR_WHITE, "Your vehicle will be ready in one hour (1 minute).");
GivePlayerMoney(playerid, - 200);
RemovePlayerFromVehicle(GetPlayerVehicleID(playerid));//remove him from the car
SetTimerEx("RepairCar",60000,false,"d",GetPlayerVehicleID(playerid));//set the timer
return 1;
}
forward RepairCar(pvehicleid);
public RepairCar(pvehicleid)
{
RepairVehicle(pvehicleid);//repair the car after 60 seconds
return 1;
}