SA-MP Forums Archive
Disconnecting a player - 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: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Disconnecting a player (/showthread.php?tid=213704)



Disconnecting a player - Nonameman - 19.01.2011

Hey!

I need a function which disconnects the player if he doesn't want to register/login. Kick() or Ban() is not the best way
to do it (but maybe the only way), so I'm trying to do something with the '/q' command, to DC from the client, not from the server.

Can I use the server to send a '/q' command to it from the player's client, and if it's possible, how?


Re: Disconnecting a player - Sascha - 19.01.2011

As far as I know it's not possible...
However if you don't want a "kick/ban" message at OnPlayerDisconnect to be shown you could use a a player param..
e.g. SetPVarInt(playerid, "ForceLeaving", 1);
and at OnPlayerDisconnect:
pawn Код:
case 2:
{
   if(GetPVarInt(playerid, "ForceLeaving") == 1)
   {
       Normal emssage;
   }else{
       kick msg;
   }
   return 1;
}



Re: Disconnecting a player - Nonameman - 19.01.2011

Quote:
Originally Posted by Sascha
Посмотреть сообщение
As far as I know it's not possible...
However if you don't want a "kick/ban" message at OnPlayerDisconnect to be shown you could use a a player param..
e.g. SetPVarInt(playerid, "ForceLeaving", 1);
and at OnPlayerDisconnect:
pawn Код:
case 2:
{
   if(GetPVarInt(playerid, "ForceLeaving") == 1)
   {
       Normal emssage;
   }else{
       kick msg;
   }
   return 1;
}
The reason I wanted to do it is to allow player to connect my server, if they change they mind about registration. And if I'm right, after X Kick() the server bans the player.


Re: Disconnecting a player - Sascha - 19.01.2011

Kick(playerid) kicks the player only... he can connect again whenever he wants.. Ban(playerid) bans the player...
Kick would work well for your useage.. I'm using it, too


Re: Disconnecting a player - Nonameman - 19.01.2011

Okey, thanks!