[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
#2

This is not a filterscript, it's already made, what else I can say?

Good try anyways, it's not -bad-.
Reply
#3

Awesome, thanks. I will use that.
Reply
#4

Quote:
Originally Posted by admantis
Посмотреть сообщение
This is not a filterscript, it's already made, what else I can say?

Good try anyways, it's not -bad-.
I've looked for it, and it has not yet been released before by someone else on this forum.. It it would already have been released I wouldn't release this.. But, thanks anyway..

Quote:
Originally Posted by costel_nistor96
Посмотреть сообщение
Awesome, thanks. I will use that.
Your welcome Good to hear
Reply
#5

If this is intended as a filterscript, then your command probably won't work because you need to '#define FILTERSCRIPT' to avoid collisions with gamemodes.
Reply
#6

simple good....good
Reply
#7

Quote:
Originally Posted by [SFA]SpiRRiT
Посмотреть сообщение
I've looked for it, and it has not yet been released before by someone else on this forum.. It it would already have been released I wouldn't release this.. But, thanks anyway..
Released almost 6 months ago.
Reply
#8

Quote:
Originally Posted by Calg00ne
Посмотреть сообщение
If this is intended as a filterscript, then your command probably won't work because you need to '#define FILTERSCRIPT' to avoid collisions with gamemodes.
I made this for people to copy and paste this in their filterscript.. Admin script or so..
But thanks, I'll edit it, and put #define FILTERSCRIPT at the top!

Quote:
Originally Posted by [RSS]Cops_sandu
Посмотреть сообщение
simple good....good
ahhahaha, thanks thanks

Quote:
Originally Posted by RyDeR`
Посмотреть сообщение
Released almost 6 months ago.
oowhh, I've looked for it before I posted this and I could find anything.. So I thought lets post this.. Sorry RyDeR..
I hope you're okay with this.. And btw, I made my reconnect cmd look more easy comparing with yours..
Anyway, my bad!
Reply
#9

simple but nice
Reply
#10

Nice
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)