SA-MP Forums Archive
[Tutorial] force a player to reconnect - 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)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] force a player to reconnect (/showthread.php?tid=178575)

Pages: 1 2


force a player to reconnect - JernejL - 22.09.2010

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.


Re: force a player to reconnect - [L3th4l] - 22.09.2010

Nice


Re: force a player to reconnect - Steven82 - 22.09.2010

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


Re: force a player to reconnect - Jantjuh - 23.09.2010

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 :


Re: force a player to reconnect - Hiddos - 23.09.2010

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


Re: force a player to reconnect - Mikkel_Pedersen - 24.09.2010

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.


Re: force a player to reconnect - Kyosaur - 24.09.2010

Nice, very clever thinking .


Re: force a player to reconnect - Hijolion - 25.09.2010

Tested in my server, worked perfectly!


Re: force a player to reconnect - Kwarde - 25.09.2010

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


Respuesta: force a player to reconnect - MrDeath537 - 27.09.2010

Very nice, I'm sure I'll use it.


Re: force a player to reconnect - Calgon - 27.09.2010

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


Re: force a player to reconnect - cyber_punk - 28.09.2010

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.


Re: force a player to reconnect - Tenshi - 10.01.2011

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...


Re: force a player to reconnect - cessil - 11.01.2011

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



Re: force a player to reconnect - JernejL - 24.02.2011

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.


Re: force a player to reconnect - Biesmen - 24.02.2011

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


Re: force a player to reconnect - black_dota - 24.02.2011

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


Re: force a player to reconnect - Hiddos - 24.02.2011

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.


Re: force a player to reconnect - Mean - 24.02.2011

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


Re: force a player to reconnect - [03]Garsino - 24.02.2011

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