It's me again.. - 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: It's me again.. (
/showthread.php?tid=647866)
It's me again.. -
BluePlayBG - 12.01.2018
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, 15.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 a half of hour (30 seconds).");
RemovePlayerFromVehicle(playerid);
SetTimerEx("RepairMyCar",30000,false,"d",GetPlayerVehicleID(playerid));
GivePlayerMoney(playerid, - 150);
return 1;
}
forward RepairMyCar(pvehicleid);
public RepairMyCar(pvehicleid)
{
RepairVehicle(pvehicleid);
return 1;
}
I am trying to make so if you leave the point
PHP код:
if(!IsPlayerInRangeOfPoint(playerid, 15.0, -2417.7744, 2303.7979, 1.8781))
the repairing process stops.
Re: It's me again.. -
Fratello - 12.01.2018
Create a timer, and in timer function check if player is range of point.
https://sampwiki.blast.hk/wiki/SetTimer
Btw, don't forget to kill/stop the timer later on.
Re: It's me again.. -
BluePlayBG - 12.01.2018
Okay, but how to stop the repairing?
I got this for now: (the things that I added are marked in red)
Код:
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, 15.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 a half of hour (30 seconds).");
RemovePlayerFromVehicle(playerid);
SetTimerEx("RepairMyCar",30000,false,"d",GetPlayerVehicleID(playerid));
SetTimer(RepairCheck, 30, false);
GivePlayerMoney(playerid, - 150);
return 1;
}
public RepairCheck()
{
if(!IsPlayerInRangeOfPoint(playerid, 15.0, -2417.7744, 2303.7979, 1.8781))
}
forward RepairMyCar(pvehicleid);
public RepairMyCar(pvehicleid)
{
RepairVehicle(pvehicleid);
return 1;
}
Re: It's me again.. -
Fratello - 12.01.2018
https://sampwiki.blast.hk/wiki/KillTimer