Login kick
#1

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.
Reply
#2

PHP код:
new LoginTimer[MAX_PLAYERS];
#define SECONDS_LOGIN    60
public OnPlayerConnect(playerid)
{
    
LoginTimer[playerid] = SetTimerEx("OnLogin"SECONDS_LOGIN 1000false"d"playerid);
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    
LoginTimer[playerid] = 0;
    return 
1;
}
forward OnLogin(playerid);
public 
OnLogin(playerid)
{
    
LoginTimer[playerid] = 0;
    
ShowPlayerDialog(playeridDIALOG_UNUSEDDIALOG_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;

Here you go
EDIT: You can change time by changing this
PHP код:
#define SECONDS_LOGIN    60 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)