SA-MP Forums Archive
how to create a delay? - 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: how to create a delay? (/showthread.php?tid=306430)



how to create a delay? - Dokins - 26.12.2011

How would I create a delay....
I.E
/engine
Code here
Delayhere
Message: engine on!

How could I do this?


Re: how to create a delay? - Scenario - 26.12.2011

You can do it with YSI's y_timers if you'd like. I find the syntax to be much easier.

pawn Код:
defer CallDelayHere(playerid);
pawn Код:
timer CallDelayHere[timeinmshere](playerid)
{
     // Whatever you want to do here...
}



Re: how to create a delay? - [MG]Dimi - 26.12.2011

pawn Код:
//add this in function
SetTimerEx("StartEngine",1000/*one second */,true,"d",GetPLayerVehicleID(playerid));


//somewhere else
public StartEngine(vehicleid)
{
    new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    SetVehicleParamsEx(vehicleid, 1,lights, alarm, doors, bonnet, boot, objective);
    return 1;
}
NOTE: UNTESTED!


Re: how to create a delay? - Dokins - 26.12.2011

Thanks!!