08.04.2014, 18:18
small script for anti-reconnect which i get out from my gamemode. Hopefully help
In OnGameModeInit
In OnPlayerConnect
In OnPlayerDisconnect
PHP код:
enum exInfo
{
ExitName[MAX_PLAYER_NAME],
ExitTime,
};
new ExitInfo[MAX_PLAYERS][exInfo],
PlayerName[MAX_PLAYERS][MAX_PLAYER_NAME];
PHP код:
for(new i=0; i<MAX_PLAYERS; i++)strmid(ExitInfo[i][ExitName],"None", 0, strlen("None"), 32), ExitInfo[i][ExitTime] = 0;
PHP код:
GetPlayerName ( playerid, PlayerName [ playerid ] , MAX_PLAYER_NAME ) ;
new unixtime = GetTickCount();
for(new i=0; i<MAX_PLAYERS; i++)
{
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", 0, strlen("None"), 32), ExitInfo[i][ExitTime] = 0;
}
}
PHP код:
strmid(ExitInfo[playerid][ExitName],PlayerName[playerid], 0, strlen(PlayerName[playerid]), 32), ExitInfo[playerid][ExitTime] = GetTickCount();