29.01.2010, 10:48
Sorry if I'm not using correct terms here but I want to create a global timer.
eg. I create a timer under one callback (OnPlayerRequestClass) and kill it under another (OnPlayerLogin).
What I'm creating is that a player has 60 seconds to login. If they do not log in within 60 seconds, they are kicked from the server.
My current code:
The timer I want to work with is located in the first paragraph of code, titled PlayerTimeOutEx. I want to kill this timer after the player logs in.
Excuse my lack of knowledge about the basic shit, I just don't understand how timer ID's work.
eg. I create a timer under one callback (OnPlayerRequestClass) and kill it under another (OnPlayerLogin).
What I'm creating is that a player has 60 seconds to login. If they do not log in within 60 seconds, they are kicked from the server.
My current code:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
if (PlayerInfo[playerid][pDeath] == 1) return SpawnPlayer(playerid);
if(gPlayerLogged[playerid] == 0)
{
//SendClientMessage(playerid, COLOR_LIGHTRED, "_________________________________________________");
if(PlayerInfo[playerid][pSQLId] != INVALID_SQL_ID)
{
//SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: You have 3 minutes to login");
new nick[128];
format(nick,sizeof(nick),"Welcome back, %s! \nPlease login in with your password below. \nHINT: You have 60 seconds to login.",PlayerInfo[playerid][pName]);
ShowPlayerDialog(playerid, 1, 1, "Login", nick, "Login", "Cancel");
SetTimer("PlayerTimeOutEx", 60000, false);
//SendClientMessage(playerid, COLOR_WHITE, nick);
//SendClientMessage(playerid, COLOR_WHITE, "HINT: Please type /login [password] to continue");
}
else
{
new nick[128];
format(nick,sizeof(nick),"SERVER: Welcome to Aria Gaming Role Play, %s! \nYour account appears to be unregistered. \nPlease type your requested password in the input box below. \nPlease make the effort to ensure your name is properly capitalized \nor you may be requested to change it.",PlayerInfo[playerid][pName]);
ShowPlayerDialog(playerid, 2, 1, "Register", nick, "Register", "Cancel");
//SendClientMessage(playerid, COLOR_LIGHTRED, nick);
//SendClientMessage(playerid, COLOR_WHITE, "HINT: You may use /register <password> to create an account");
//SendClientMessage(playerid, COLOR_WHITE, "HINT: Please make the effort to ensure your name is properly capitalized or you may be requested to change it");
}
}
return 0;
}
Excuse my lack of knowledge about the basic shit, I just don't understand how timer ID's work.