Banned user doesn't disconnect

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

moonlife
Posts: 45
Joined: 26 Sep 2016, 08:22

Banned user doesn't disconnect

Postby moonlife » 19 Dec 2016, 13:01

Hi,

In my game, I'm trying to ban users.
When I ban a user via Sfsadmin Panel, USER_DISCONNECT event is firing, just like as I wish.
But when I ban a user in my game through Java Extension, USER_DISCONNECT event doesn't fire, so user remains in room. I tried to kick user after I ban him to make sure he disconnects, but it didn't work either.

Here is the method I use:

Code: Select all

sfs.banUser(user1, null, "You are banned", banMode, minutes, 0);
sfs.kickUser(user1, null, "", 0);


What am I doing wrong?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Banned user doesn't disconnect

Postby Lapo » 20 Dec 2016, 16:46

Hi,
it looks like you're calling the banUser function with wrong parameters.

In the documentation this is the example of usage:

Code: Select all

_server.banUser(bannableUser, 10, "You're banned!", _server.BAN_BY_NAME)


You're passing 6 parameters, but the function requires four. More details here:
http://www.smartfoxserver.com/docs/1x/d ... /index.htm

cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
moonlife
Posts: 45
Joined: 26 Sep 2016, 08:22

Re: Banned user doesn't disconnect

Postby moonlife » 20 Dec 2016, 18:05

Hi,

this is java extension code which I have sent, and this function requires 6 parameters as you can see the attachment.

Screen Shot 2016-12-20 at 21.07.03.png
(49.34 KiB) Not downloaded yet
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Banned user doesn't disconnect

Postby Lapo » 21 Dec 2016, 08:38

(You have posted in the wrong section, you're using SFS2X, not SFS 1.x -- I have moved the discussion)

I'd recommend to check your logs and see if there's any error relative to the call to banUser().
As a side note the last parameter (delay = 0) will prevent the target user to receive the banning message. I'd recommend to leave at least 3 seconds of delay so that the message can be sent and received by the client.

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 48 guests