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...");
}
Bem interessante .. Nunca tinha visto.
dudaefj, seria possivel vocк postar as publics OnPlayerConnect e OnPlayerDisconnect ? |
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;
}
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;
}