SetTimer *inside* a function?
#1

Hello, Is there any function that works like SetTimer but you can use it inside a function?
If you don't get what i mean, heres an example:
pawn Код:
if(strcmp("/loltele", cmdtext, true)==0)
{
  SetPlayerPos(playerid, 250, 250, 250);
  CountDown(5000)//The function, set at 5000 milliseconds
  {
    SetPlayerPos(playerid, 500, 500, 500);//This happens 5000 milliseconds after the CountDown callback got called
  }
  return 1;
}
First when you type /loltele you get teleported to the 250, 250, 250 coords.
Then 5 seconds after you got teleported to the 250, 250, 250 coords, teleport you to the 500, 500, 500 coords.
Reply
#2

Sleep does it but i think this Pawn Script dont Cotains this Function and it Freeze the Script.
SetTimerEx is the best way atm
Reply
#3

Please explain SetTimerEx to me, wiki doesnt say much...
Reply
#4

Код:
public teleport(playerid,Float:x,Float:y,Float:z)return SetPlayerPos(playerid,x,y,z);
Код:
SetTimerEx("teleport",5000,0,"ifff",playerid,your_x,your_y,your_z);
Reply
#5

pawn Код:
if(strcmp("/loltele", cmdtext, true)==0)
{
  SetPlayerPos(playerid, 250, 250, 250);
  SetTimerEx("Timer", 5000, false, "d"/* D is the format (Number)*/, playerid); //Will save the playerid varaible in the timer.
  return 1;
}

forward Timer(playerid);
public Timer(playerid)
{
  SetPlayerPos(playerid, 500, 500, 500);
  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)