SA-MP Forums Archive
[FilterScript] Reconnect Command (ready-for-use) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Reconnect Command (ready-for-use) (/showthread.php?tid=253451)



Reconnect Command (ready-for-use) - [SFA]SpiRRiT - 06.05.2011

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;
}



Re: Reconnect Command (ready-for-use) - admantis - 06.05.2011

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

Good try anyways, it's not -bad-.


Re: Reconnect Command (ready-for-use) - IstuntmanI - 06.05.2011

Awesome, thanks. I will use that.


Re: Reconnect Command (ready-for-use) - [SFA]SpiRRiT - 06.05.2011

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


Re: Reconnect Command (ready-for-use) - Calgon - 06.05.2011

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.


Re: Reconnect Command (ready-for-use) - Skaizo - 06.05.2011

simple good....good


Re: Reconnect Command (ready-for-use) - RyDeR` - 06.05.2011

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.


Re: Reconnect Command (ready-for-use) - [SFA]SpiRRiT - 06.05.2011

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!


Re: Reconnect Command (ready-for-use) - Ironboy - 07.05.2011

simple but nice


Re : Reconnect Command (ready-for-use) - Varkoll_ - 07.05.2011

Nice