Timer HELP
#2

pawn Код:
new UserTimer[MAX_PLAYERS]; // New variable for the timer is created.

forward SixtySeconds(playerid); // Forward the callback.

public OnPlayerDisconnect(playerid, reason)
{
    KillTimer(UserTimer[playerid]); // Kills the timer. (In case it is currently running or still active).
    return 1;
}

public OnPlayerConnect(playerid)
{
    UserTimer[playerid] = SetTimerEx("SixtyMinutes", 3600000, false, "d", playerid); // Set the timer and assign it to the variable. There are 3600000 miliseconds in one hour. This should be placed accordingly, as the timer will start once the user has connected, NOT logged in.
    return 1;
}

public SixtySeconds(playerid) // The new callback.
{
    SendClientMessage(playerid, -1, "It has been one hour since your login."); // Send the user a message after it has been one hour.
    return 1;
}
Refer to:
SetTimerEx
Public Functions
Reply


Messages In This Thread
Timer HELP - by necrobg3 - 26.09.2012, 20:01
Re: Timer HELP - by West X - 26.09.2012, 21:26
Re: Timer HELP - by necrobg3 - 27.09.2012, 19:51

Forum Jump:


Users browsing this thread: 2 Guest(s)