How do I set a delay?
#1

I know how to set a timer, for example I have a 15 second timer for my nos to reset all the time, what I want to know is how to set a delay. A timer wouldn't work, because lets say I set a 1 second timer, the effect can take place anywhere from 0 to 1 seconds.

If you need me to be more specific, I want my Cars FS to set vehicles back to the spawn point , but only after say, 5 seconds after a player exits the vehicle. Here's what I have so far.

#include <a_samp>

public OnPlayerExitVehicle(playerid, vehicleid)
{
SetVehicleToRespawn(vehicleid);
return 1;
}
Reply
#2

Quote:

#include <a_samp>
forward cardestroy(vehicleid);

public OnPlayerExitVehicle(playerid, vehicleid)
{
SetTimerEx("cardestroy",5000,0,"i",vehicleid);
return 1;
}

public cardestroy(vehicleid)
{
SetVehicleToRespawn(vehicleid);
}

Untested
Reply
#3

ok thanks, my point is to learn rather than just get a code

so im guessing that SetTimerEx rather than SetTimer runs a timer just once and that's it?
Reply
#4

SetTimerEx can send variables over the timer as SetTimer cant.
Have a look at this: Wiki
Reply
#5

so which is the code ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)