[HELP]How to add SetTimer ??? +REP
#1

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
Reply
#2

Read the wiki
Reply
#3

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;
}
Reply
#4

Wowwww...
Thank You ...

+REP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)