Best way to reconnect a player (banip/unbanip)
#1

Hello, I have a reconnect command but it doesn't seem to be working correctly. It disconnects but it says the player is banned, if I use a CLEO mod to reconnect, it'll reconnect after around 10 attempts, so it makes me believe this is caused by additional attack security measures added in 0.3z.

Code:

CMD:
pawn Код:
CMD:reconnect(playerid, params[])
{
    if( gPlayerInfo[playerid][pAlevel] < 1) return accessdenied(playerid);
    new target, reason[40], string[80];
    if(sscanf(params, "us[40]", target, reason)) return SendUsage(playerid, "USAGE: /reconnect [ID/name] [reason]");
    if(target == INVALID_PLAYER_ID) return SendClientMessage(playerid, notconnected);
    if(strlen(reason) > 40)
        return SendClientMessage(playerid, COLOR_RED, "Reason must be below 40 characters.");
    GetPlayerIp(target, ReconnectPIP[target], 16);
    ssstring("[RECONNECT] %s was forced to reconnect by %s. [reason: %s]", gPlayerInfo[target][pName], gPlayerInfo[playerid][pName], reason);
    SendClientMessageToAll(COLOR_RED, ssstring);
    for (new i=0;i<=20;i++) SendClientMessage(target, -1, " ");
    String("Administrator %s has forced you to reconnect. [reason: %s]", gPlayerInfo[playerid][pName], reason);
    GameTextForPlayer(target, "~w~please wait...~n~~r~reconnecting to server", 5000, 3);
    SendClientMessage(target, COLOR_RED, string);
    ssstring("banip %s", ReconnectPIP[target]);
    SendRconCommand(ssstring);
    IsReconnecting[target] = true;
    return 1;
}
OnPlayerDisconnect:
Код:
	if(IsReconnecting[playerid])
	{
		new string[30];
		format(string, sizeof(string), "unbanip %s", ReconnectPIP[playerid]);
		SendRconCommand(string);
		SendRconCommand("reloadbans");
		IsReconnecting[playerid] = false;
		print(string);
	}
Reply
#2

use this --
pawn Код:
BlockIpAddress(PLAYER_IP, 5);//blocks ip for 5ms
And with this you don't need to do the OnPlayerDisconnect thing and also u do not need SendRcon in dat command
Reply
#3

Quote:
Originally Posted by ******
Посмотреть сообщение
Why not just kick them and let them reconnect through the client?

Also, you didn't actually ask any questions in that post, which is generally required when "asking" for help.
My bad. I stated the issue but I can see that it's not clear. In response, I want to make reconnecting as simple as possible so that it's as least annoying as possible.




BroZeus: Tried with BlockIpAddress - still requires something on OnPlayerDisconnect as you can't really tell the exact time they're gonna reconnect, it still doesn't seem to work all of the time. Half the time you reconnect and get greeted with "You are banned from this server".
Reply
#4

It's always best that the client closes their game and reconnects otherwise there is a potential for client bugs to occur.
Reply
#5

It's not hard to /q(uit) or ESC > Quit Game.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)