[Tutorial] AntiReconnect
#1

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(); 
Reply


Messages In This Thread
AntiReconnect - by d0nTtoucH - 08.04.2014, 18:18
Re: AntiReconnect - by Jochemd - 08.04.2014, 18:25
Re: AntiReconnect - by TheFlyer - 12.04.2014, 21:22
Re: AntiReconnect - by Flake. - 13.04.2014, 04:32

Forum Jump:


Users browsing this thread: 1 Guest(s)