[AJUDA] Interpretar Codigo
#1

Aew galera
alguйm poderia ajudar a interpretar o comando /reconnect ?
pelo que eu entendi ele bane o ip e depois, magicamente o kara reconecta... nгo entendi isso ;x


PHP код:

if(strcmp(cmd, "/reconnect", true)==0)
{
        if(
PlayerInfo[playerid][PlayerAdmin] < 7) return SendClientMessage(playerid,COLOR_RED, "You Cant Use This Command !!!");
        if((
cmdtext[10] != ' ') || (cmdtext[11] == EOS)) return SendClientMessage(playerid, 0xFFFFFFFF, ""WHITE" Usage: "GREEN"/Reconnect "WHITE"[playerid]");
        new 
string[16 + 6],destid = strval(cmdtext[11]),ipstring[16];
        if(!
IsPlayerConnected(destid)) return SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}» Error: {FFFFFF}Player is not connected!");
        
GetPlayerIp(destid, ipstring, 16), SetPVarString(destid, "pIp", ipstring);
        
format(string, sizeof(string), "banip %s",ipstring);
        
SendRconCommand(string);
        
PlayerReconnecting[destid]=1;
        return 
SendClientMessage(destid, 0xFFFFFFFF, "Reconnecting...");
} 
Reply
#2

pelo o que eu entendi isso й para simular uma queda de conexгo com o servidor para o id selecionado e banir ele.
:S
Reply
#3

Nгo, ele bane o ip isso vai fazer o player cair e logo no OnPlayerDisconnect ele vai desbanir o ip e com isso o player vai reconectar
Reply
#4

Como RockFire disse, serve para reconectar o jogador ao server sem precisar fechar o samp.
Reply
#5

Bem interessante .. Nunca tinha visto.

dudaefj, seria possivel vocк postar as publics OnPlayerConnect e OnPlayerDisconnect ?
Reply
#6

Quote:
Originally Posted by Shadoww5
Посмотреть сообщение
Bem interessante .. Nunca tinha visto.

dudaefj, seria possivel vocк postar as publics OnPlayerConnect e OnPlayerDisconnect ?
seria, claro!
que bom que posso de alguma forma ajudar alguйm :]
mas antes de tudo os crйditos pela crianзгo desse comando que alguns "nunca viram" й do park4bmx
mREGV0.7





PHP код:
public OnPlayerConnect(playerid)
{
    
ResetSettings(playerid);
    
SetPlayerColor(playerid, PlayerColors[playerid]);
    
TogglePlayerSpectating(playerid, 1);
    
IsLogged[playerid] = 0;
    new 
file[128], string[128],name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid, name, sizeof(name));
    
format(file,sizeof(file),"/mRegistration/Users/%s.txt",name);
    if(!
fexist(file))
    {
        
ShowPlayerDialog(playerid, WELCOME1, DIALOG_STYLE_MSGBOX, " ", ""WHITE"Bem Vindo ao "BLUE""SERVER_NAME"", "Nгo Enxe!", "Registrar");
    }
    if(
fexist(file))
    {
        
format(file,sizeof(file),"/mRegistration/Settings/%s.txt",name);
        
INI_ParseFile(file, "LoadAutoLog", false, true, playerid, true, false);
        
PlayerInfo[playerid][AutoLogin] = GetPVarInt(playerid,"AutoLog");
        if(
PlayerInfo[playerid][AutoLogin] == 0){
        
ShowPlayerDialog(playerid, WELCOME2, DIALOG_STYLE_MSGBOX, ""WHITE"Bem Vindo ao "BLUE""SERVER_NAME"", ""WHITE"Use "GREEN"/AutoLog "WHITE"se voce quiser fazer login automaticamente na proxima vez", "Pular", "Login");
        }else if(
PlayerInfo[playerid][AutoLogin] >= 1)
        {
            
format(file,sizeof(file),"/mRegistration/Users/%s.txt",name);
            
INI_ParseFile(file, "LoadUserIp", false, true, playerid, true, false );
            
GetPlayerIp(playerid,rip[playerid],16);
               new 
IPa[80]; GetPVarString(playerid, "pIP", IPa, sizeof IPa);
             if(!
strcmp(rip[playerid],IPa,true))
            {
                
LoadStatus(playerid);
                
TogglePlayerSpectating(playerid, 0);
                
SetTimer("IsLoggedTimer",1500,false);
                
SpawnPlayer(playerid);
                
format(string, sizeof(string), ""YELLOW"[SERVER] "GREEN"%s "WHITE"Logou-se com sucesso! :D",name );
                
SendClientMessageToAll(COLOR_GREEN2, string);
                
printf("%s Has Logged Into His Account", name);
            }else{
                
format(string, sizeof string, ""WHITE"Seu IP e sua senha nгo batem: "BLUE"%s "WHITE"\nPara logar-se digite sua senha:", name);
                
ShowPlayerDialog(playerid, Login, DIALOG_STYLE_MSGBOX, ""RED"Login Failed", string, "OK", "Cancelar");
            }
        }
        return 
1;
    }
     return 
0;
} 

PHP код:
public OnPlayerDisconnect(playerid, reason)
{
    if(
PlayerReconnecting[playerid]==1)
    {
        new 
string[8+16];
         
GetPVarString(playerid, "pIp", string, 16);
        
format(string, sizeof(string), "unbanip %s", string);
        
SendRconCommand(string);
    }
    
SaveStatus(playerid);
    
ResetSettings(playerid);
    
IsLogged[playerid] = 0;
    
KillTimer(TimeTimer);
    
KillTimer(AutoSaveTimer[playerid]);
    return 
1;
} 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)