[FilterScript] Reconnect Command (ready-for-use)
#1

RECONNECT CMD

I've received some request to send some people the reconnect code. So I decided to put it up here.

So about this script,

Normally if a player is pausing you want to kick him, and let him reconnect when he comes back, this is how it works:

----------------------------------------------------------------------------------------------------
1.)
Rcon ban the ip with a code, but DON'T KICK the player.
2.)
The player will then timeout, at OnPlayerDisconnect unban the ip that you've just banned -
remember that GetPlayerIP doesn't work in OnPlayerDisconnect, so store the value elsewhere.
3.)
Player's Client will lose connection and attempt to auto-reconnect afterwards.
----------------------------------------------------------------------------------------------------


So here it is:

pawn Код:
#include <zcmd>

#define FILTERSCRIPT
new ireconnect[MAX_PLAYERS];

public OnPlayerDisconnect(playerid, reason)
{
    if(ireconnect[playerid] == 1)
    {
            new unbanningip[16], string[128];
            GetPVarString(playerid, "reconnect", unbanningip, 16);// Get the msg string from the PVar
            format(string,sizeof(string),"unbanip %s", unbanningip);
            SendRconCommand(string);
            printf(string);
            SendRconCommand("reloadbans");
            ireconnect[playerid] = 0;
    }
    return 1;
}

//==============================================================================
// Reconnect
//==============================================================================
COMMAND:reconnect(playerid, params[])
{
    new pid;
    if(sscanf(params, "us", pid, params[2])) return SendClientMessage(playerid, 0xFF0000AA, "Command Usage: /reconnect [playerid] [reason]");
    if(level[playerid] >= 1 || viplevel[playerid] == 2)//change these to the way you got it in your admin script. this is the way I got it, so..
    {
        if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, red, "ERROR: That player is not online.");
        new adminname[MAX_PLAYER_NAME], paramname[MAX_PLAYER_NAME], string[180];
        new ip[16];
        GetPlayerIp(pid, ip, sizeof(ip));
        GetPlayerName(pid, paramname, sizeof(paramname));
        GetPlayerName(playerid, adminname, sizeof(adminname));
        format(string, sizeof(string), "Administrator %s has forced %s to reconnect. [Reason: %s]", adminname, paramname, params[2]);
        SendClientMessageToAll(red, string);
        print(string);
        format(string, sizeof(string), "banip %s", ip);
        SetPVarString(pid,"reconnect",ip);
        ireconnect[pid] = 1;
        SendRconCommand(string);
    }
    else SendClientMessage(playerid, red, "Error: You must be a higher level administrator to use that command.");
    return 1;
}
Reply


Messages In This Thread
Reconnect Command (ready-for-use) - by [SFA]SpiRRiT - 06.05.2011, 17:51
Re: Reconnect Command (ready-for-use) - by admantis - 06.05.2011, 17:55
Re: Reconnect Command (ready-for-use) - by IstuntmanI - 06.05.2011, 17:56
Re: Reconnect Command (ready-for-use) - by [SFA]SpiRRiT - 06.05.2011, 18:04
Re: Reconnect Command (ready-for-use) - by Calgon - 06.05.2011, 18:07
Re: Reconnect Command (ready-for-use) - by Skaizo - 06.05.2011, 18:07
Re: Reconnect Command (ready-for-use) - by RyDeR` - 06.05.2011, 18:08
Re: Reconnect Command (ready-for-use) - by [SFA]SpiRRiT - 06.05.2011, 18:10
Re: Reconnect Command (ready-for-use) - by Ironboy - 07.05.2011, 05:31
Re : Reconnect Command (ready-for-use) - by Varkoll_ - 07.05.2011, 05:42

Forum Jump:


Users browsing this thread: 2 Guest(s)