SA-MP Forums Archive
[HELP]How to add SetTimer ??? +REP - 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: [HELP]How to add SetTimer ??? +REP (/showthread.php?tid=473267)



[HELP]How to add SetTimer ??? +REP - WhiteAngels - 02.11.2013

How to Add SetTimerEx in This Code
Код:
CMD:lsa(playerid,params[]) {
    SetPlayerPos(playerid, 1486.3853,-2493.8481,13.5547);
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof (string),"[TELEPORT] %s has teleported to Los Santos Airport",pName); 
    SendClientMessageToAll(0x33FF33AA,string);
    return 1;
    }

CMD:sfa(playerid,params[]) {
    SetPlayerPos(playerid, -1657.4110,-164.6259,14.1484);
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof (string),"[TELEPORT] %s has teleported to San Fierro Airport",pName);
    SendClientMessageToAll(0x33FF33AA,string);
   	return 1;
    }

CMD:lva(playerid,params[]) {
    SetPlayerPos(playerid, 1477.5079,1813.3340,10.8125);
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME); 
    format(string,sizeof (string),"[TELEPORT] %s has teleported to Las Venturas Airport",pName); 
    SendClientMessageToAll(0x33FF33AA,string);
    return 1;
    }
I'll give +1 REP for who can Add SetTimer In This Code


Re: [HELP]How to add SetTimer ??? +REP - Isolated - 02.11.2013

Read the wiki


Re: [HELP]How to add SetTimer ??? +REP - SilentSoul - 02.11.2013

https://sampwiki.blast.hk/wiki/SetTimerEx
I'll give you small example how to use that
pawn Код:
CMD:lsa(playerid,params[]) {
    SetTimerEx("Teleporttimer", 5000, false, "i", playerid); //timer 5 seconds
    SendClientMessage(playerid,-1,"You will be teleported after 5 seconds");
    return 1;
    }
Add that anywhere in your script
pawn Код:
forward Teleporttimer(playerid);
 
// The timer function - the code to be executed when the timer is called goes here
public Teleporttimer(playerid)
{
    // 5 seconds has passed
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof (string),"[TELEPORT] %s has teleported to Los Santos Airport",pName);
    SendClientMessageToAll(0x33FF33AA,string);
    SetPlayerPos(playerid, 1486.3853,-2493.8481,13.5547);
    SendClientMessage(playerid, -1, "Teleported");
    return 1;
}



Re: [HELP]How to add SetTimer ??? +REP - WhiteAngels - 02.11.2013

Wowwww...
Thank You ...

+REP