Reconnect possible 0.3z?
#1

Hello, is a reconnect command to reconnect someone, still possible in 0.3z?
Reply
#2

Was it even possible in the older versions?
Reply
#3

Yus its in useful functions thread iirc, or use search
Reply
#4

pawn Код:
new bool:reconnecting[MAX_PLAYERS];
new playersip[MAX_PLAYERS][16];

public OnPlayerConnect(playerid)
{
    reconnecting[playerid] = false;
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/reconnectme", true) == 0)
    {
        if(reconnecting[playerid]) return SendClientMessage(playerid, 0xFF0000FF, "You are already being reconnected, please wait.");
        SendClientMessage(playerid, 0xFFFF00FF, "You are now being reconnected. Please wait while the server reconnects you.");
        GetPlayerIp(playerid, playersip[playerid], 16);
        reconnecting[playerid] = true;
        new rconmsg[25];
        format(rconmsg, sizeof(rconmsg), "banip %s", playersip[playerid]);
        SendRconCommand(rconmsg);
        return 1;
    }
    return 0;
}

public OnPlayerDisconnect(playerid, reason)
{
    if(reconnecting[playerid])
    {
        new rconmsg[25];
        format(rconmsg, sizeof(rconmsg), "unbanip %s", playersip[playerid]);
        SendRconCommand(rconmsg);
        SendRconCommand("reloadbans");
    }
    return 1;
}
NOTE: This doesn't work 100% of the time, I don't know of any that actually does. If the player reconnects before the reloadbans command is actually sent (which can occur like 10% of the time), then it will deny him access to the server and he will have to /quit and relog. However, this is one of the only ways to actually reconnect a player as far as I know. Players won't be banned innocently however, the ip ban is removed when they disconnect. So don't worry about having to unban players that haven't been unbanned correctly.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)