23.08.2015, 21:48
How do I create an new SetTimerEx function?
Currently I want this function to create "DelayedConnect"
Currently I want this function to create "DelayedConnect"
How do I create an new SetTimerEx function?
Currently I want this function to create "DelayedConnect" |
new PlayerConnectTimer[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
PlayerConnectTimer[playerid] = SetTimerEx("DelayedConnect", 5000, false, "i", playerid);
return 1;
}
public OnPlayerDisconnect(playerid, reason) return KillTimer(PlayerConnectTimer[playerid]);
forward DelayedConnect(playerid);
public DelayedConnect(playerid)
{
PlayerConnectTimer[playerid] = 0;
return 1;
}
public OnPlayerConnect(playerid) { SetTimerEx("DelayedFunction", 1000, false, "i", playerid); //calling function "DelayedFunction", AFTER 1000ms, nonrepeating, passing playerid to the function return 1; } forward DelayedFunction(playerid); public DelayedFunction(playerid) { SendClientMessage(playerid, -1, "This message will be delayed 1 second after "OnPlayerConnect" is called."); }
public OnPlayerConnect(playerid)
{
new string[350], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(string,sizeof string, "%s has joined the server.", pName);
SetTimerEx("DelayedConnect", 2000, false, "i", playerid);
SendClientMessageToAll(COLOR_GREY, string);
return 1;
}
forward DelayedConnect(playerid);
public DelayedConnect(playerid);
Sorry for double post, but I will explain it.
PHP код:
|
forward DelayedFunction(playerid);
public DelayedFunction(playerid)
{
new pName[24];
GetPlayerName(playerid, pName, 24);
new string[128];
format(string, sizeof string, "(%s) has joined the server.", pName);
SendClientMessageToAll(-1, string);
return 1;
}