[Tutorial] force a player to reconnect
#1

This is fairly simple thing to achieve, so i did not include code.

Basically, sometimes you want a player to reconnect - say if a player pauses and you wish to kick him & have him reconnect when he returns, or for various other reasons, so this is how it works:

1. In code, rcon ban the ip, but DON'T KICK the player
2. The player will timeout, in onplayerdisconnect unban the ip that was banned for him - remember that getplayerip doesnt work in onplayerdisconnect, so store the value elsewhere.
3. Player's client will lose connection and attempt to auto-reconnect afterwards.
Reply
#2

Nice
Reply
#3

Have you tested this to make sure? Or are you assuming it will work? 0.0
Reply
#4

Quote:
Originally Posted by Steven82
View Post
Have you tested this to make sure? Or are you assuming it will work? 0.0
ye, it sure works, i teted it and it is an awesome handy way :
Reply
#5

Looks nice, another "glitch". If I were still scripting, I'd use it hehe.
Reply
#6

Wauw thanks a lot for showing us this. I tried making a command to force players to reconnect. And i may say i had some problems, first transfering the ip in a timer. But i got that fixed. And then had to find the time until it should unban you. But now it works.
Reply
#7

Nice, very clever thinking .
Reply
#8

Tested in my server, worked perfectly!
Reply
#9

Indeed. But I already used this in my server (my OLD server)
Reply
#10

Very nice, I'm sure I'll use it.
Reply
#11

Nice one, I'll try to make use of this later.
Reply
#12

Nice, I have a bit of an off topic question (could kinda be on topic) but I read in another thread that you have a way to detect the half connected bug. My question is are you simply just checking the time between player updates and if its over a certain time you know they missed some updates/timed out and are therefore in a desync'ed state? Just kinda curious because using your reconnect method with the half connected detection would be really really nice and very useful.
Reply
#13

not trying to be mean or selfish, but how is this listed as a Tutorial?
more like how to idea, not really tutorial, just saying...
Reply
#14

here's an example of what it may look like
pawn Код:
OnPlayerConnect(playerid)
{
    new IP[20];
    GetPlayerIp(playerid,IP,sizeof(IP));
    SetPVarString(playerid,"ip",IP);
}
OnPlayerBugged(playerid)
{
    SetPVarInt(playerid,"bugban",1);
    new IP[24];
    GetPlayerIp(playerid,IP,sizeof(IP));
    format(IP,sizeof(IP),"banip %s",IP);
    SendRconCommand(IP);
}
OnPlayerDisconnect(playerid)
{
    if(GetPVarInt(playerid,"bugban") == 1)
    {
        new string[24];
        GetPVarString(playerid,"ip",string,sizeof(string));
        format(string,sizeof(string),"unbanip %s",string);
        SendRconCommand(string);
        SendRconCommand("reloadbans");
    }
}
Reply
#15

You don't have to use reloadbans if you use rcon unbanip ingame.
reloadbans is only needed to reload samp.ban file if you changed it externally.
Reply
#16

Quote:
Originally Posted by Tenshi
Посмотреть сообщение
not trying to be mean or selfish, but how is this listed as a Tutorial?
more like how to idea, not really tutorial, just saying...
How to and Tutorial is the same.

-- On topic:

Thanks. I'm gonna use this
Reply
#17

Why to unban and all that shit, simply make command fakeban or fban and then in code just kick the player but add the message You have been banned from this server
Reply
#18

Quote:
Originally Posted by black_dota
Посмотреть сообщение
Why to unban and all that shit, simply make command fakeban or fban and then in code just kick the player but add the message You have been banned from this server


If you actually would read the thread you might notice that it explains how to re-connect a player serversided, not a way to fake a ban.
Reply
#19

Thank you. Lovely.
EDIT: How do I unban an IP in RCON?
Reply
#20

Quote:
Originally Posted by Mean
Посмотреть сообщение
Thank you. Lovely.
EDIT: How do I unban an IP in RCON?
SendRconCommand + unbanip IP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)