SA-MP Forums Archive
[Tutorial] AntiReconnect - 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)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] AntiReconnect (/showthread.php?tid=505486)



AntiReconnect - d0nTtoucH - 08.04.2014

small script for anti-reconnect which i get out from my gamemode. Hopefully help
PHP код:
 enum exInfo
{
    
ExitName[MAX_PLAYER_NAME],
    
ExitTime,
};
new 
ExitInfo[MAX_PLAYERS][exInfo],
    
PlayerName[MAX_PLAYERS][MAX_PLAYER_NAME]; 
In OnGameModeInit
PHP код:
for(new i=0i<MAX_PLAYERSi++)strmid(ExitInfo[i][ExitName],"None"0strlen("None"), 32), ExitInfo[i][ExitTime] = 0
In OnPlayerConnect
PHP код:
 GetPlayerName playeridPlayerName playerid ] , MAX_PLAYER_NAME ) ;
new 
unixtime GetTickCount();
    for(new 
i=0i<MAX_PLAYERSi++)
    {
        if(!
strcmp(ExitInfo[i][ExitName],PlayerName[playerid],true))
        {
            if(
unixtime ExitInfo[i][ExitTime] <= 30000) return Kick(playerid) ,SendClientMessage(playerid,COLOR_GOLD,"Reconnect again after 30 seconds.");
            else 
strmid(ExitInfo[i][ExitName],"None"0strlen("None"), 32), ExitInfo[i][ExitTime] = 0;
        }
    } 
In OnPlayerDisconnect
PHP код:
strmid(ExitInfo[playerid][ExitName],PlayerName[playerid], 0strlen(PlayerName[playerid]), 32), ExitInfo[playerid][ExitTime] = GetTickCount(); 



Re: AntiReconnect - Jochemd - 08.04.2014

1. This isn't a tutorial since you don't explain anything
2. You don't retrieve unix times with GetTickCount(), but with gettime().
3. I doubt this works


Re: AntiReconnect - TheFlyer - 12.04.2014

I didn't understand nothing from this script. plz explain


Re: AntiReconnect - Flake. - 13.04.2014

This wouldn't work.. And even if it did it wouldn't be very reliable. Also as Jochemd said, this isn't a tutorial because you didn't explain anything.