Destroy vehicle timer - 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: Destroy vehicle timer (
/showthread.php?tid=567249)
Destroy vehicle timer -
MegaTheVova - 12.03.2015
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(GetPlayerState(playerid)==PLAYER_STATE_DRIVER)
{
DestroyVehicle(vehicleid);
}
return 1;
}
I need destroy vehicle after 2 minutes.. help me please..
Respuesta: Destroy vehicle timer -
JuanStone - 12.03.2015
using settimerex.
PHP код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
SetPVarInt(playerid, "vid", GetPlayerVehicleID(playerid));
SetTimerEx("removevehicle", 1000*60*2, false, "d", playerid);
}
return true;
}
forward removevehicle(playerid);
public removevehicle(playerid)
{
DestroyVehicle(GetPVarInt(playerid, "vid"));
SetPVarInt(playerid, "vid", 0);
return true;
}
Re: Destroy vehicle timer -
CalvinC - 12.03.2015
Use SetTimerEx.
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(GetPlayerState(playerid)==PLAYER_STATE_DRIVER) SetTimerEx("TimerName", 120000, false, "i", vehicleid);
// Set a timer of 120.000 milliseconds (2 minutes)
// "false" to be non-repeating
// Passes on the vehicleid as an integer
return 1;
}
pawn Код:
forward TimerName(vehicleid);
public TimerName(vehicleid) DestroyVehicle(vehicleid);
// When the timer is done, it executes the function in the public, which in this case is DestroyVehicle
Re: Destroy vehicle timer -
MegaTheVova - 12.03.2015
Thank you very much guys