11.11.2016, 06:03
Hello, I was looking forward on how to add a 60 seconds timer on my login dialog so that if the player fails to login in 60 seconds, the player should be kicked.
new LoginTimer[MAX_PLAYERS];
#define SECONDS_LOGIN 60
public OnPlayerConnect(playerid)
{
LoginTimer[playerid] = SetTimerEx("OnLogin", SECONDS_LOGIN * 1000, false, "d", playerid);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
LoginTimer[playerid] = 0;
return 1;
}
forward OnLogin(playerid);
public OnLogin(playerid)
{
LoginTimer[playerid] = 0;
ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Login", "You have been kicked for taking too long to login to your account", "Okay", "");
Kick(playerid);
return 1;
}
public OnPlayerSpawn(playerid)
{
KillTimer(LoginTimer[playerid]); //this you can put when player succes on login but i've put it under OnPlayerSpawn because I don't know your login sys
return 1;
}
#define SECONDS_LOGIN 60