26.09.2012, 20:01
Hey guys. How to create a timer from the login of the player until 60 minutes? I will be very glad if anyone try to make it.
+REP for the dude who make it.
+REP for the dude who make it.
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;
}