SA-MP Forums Archive
Login kick - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Login kick (/showthread.php?tid=621447)



Login kick - freshy - 11.11.2016

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.


Re: Login kick - Micko123 - 11.11.2016

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