SA-MP Forums Archive
HELP Me with reconnect cmds - 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: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: HELP Me with reconnect cmds (/showthread.php?tid=628993)



HELP Me with reconnect cmds - TheseMan - 18.02.2017

Hello, can someone make me a reconnect command? the player can use it too
Thanks a lot


Re: HELP Me with reconnect cmds - Sumit4 - 18.02.2017

Код:
#include <a_samp>
#include <zcmd>
new ReconnectIP[MAX_PLAYERS][32];
new bool: Reconnecting[MAX_PLAYERS];
#define MAX_IP_SIZE 32
 
CMD:reconnect(playerid, params[])
{
        if(IsPlayerConnected(playerid))
        {
            new
                string[64];
            new playerIP[32];
            GetPlayerIp(playerid, playerIP, sizeof(playerIP));
            format(ReconnectIP[playerid], MAX_IP_SIZE, "%s", playerIP);
            format(string, sizeof(string), "banip %s", playerIP);
            SendRconCommand(string);
            SendClientMessage(playerid, -1, "Reconnecting...");
            Reconnecting[playerid] = true;
            return 1;
        }
        return 1;
}
 
public OnPlayerDisconnect(playerid, reason)
{
        if(Reconnecting[playerid] == true)
        {
            new string[64];
            format(string, sizeof(string), "unbanip %s", ReconnectIP[playerid]);
            SendRconCommand(string);
            Reconnecting[playerid] = false;
        }
        return 1;
}



Re: HELP Me with reconnect cmds - TheseMan - 18.02.2017

It send me a warning


Re: HELP Me with reconnect cmds - RyderX - 18.02.2017

Quote:
Originally Posted by TheseMan
Посмотреть сообщение
It send me a warning
Loose indentation?


Re: HELP Me with reconnect cmds - TheseMan - 18.02.2017

unreachable code


Re: HELP Me with reconnect cmds - TheseMan - 18.02.2017

Solved! thank you all