[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
#2

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
Reply
#3

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)