Page 1 of 1

kickUser not working

Posted: 19 Aug 2011, 09:35
by harsha

I am trying to kick the first logged in user from the zone when a second user logs in using the same account.

This is my code

Code: Select all

      if(pass == "common")
         // Check login
         if (listByname[nick])
            var response = new Object()
            response._cmd = "loginKO";
            error = "this user is already loged in from another computer";
            response.err = error;
            response.status = 404;
            response.username = nick;

            _server.sendResponse(response, -1, null, chan);
            _server.kickUser(listByname[nick],0,'test Kick');
            // We ask the server to login this new user
            loginCustomUser(nick, pass, chan);

and I am trying to access the evenr in this way

Code: Select all

public function onAdminMessageHandler(evt:SFSEvent):void
          trace("evt.params.message" + evt.params.message);

The trace is working fine yet the user is not getting kicked.
I tried to manually kick the user from the admin.
The message gets passed and the user doesn't get kicked.
Can anyone tell me what might be wrong?
Thanks in advance :)

Posted: 19 Aug 2011, 21:24
by BigFIsh
You seem to be doing it the hard way. There's an easier way to do it. Use 'forceLogin'. See It will automatically disconnect the first user when a second user tries to log in with the same username.

Posted: 11 Oct 2011, 08:02
by harsha
Hi bigfish,

Thanks for the reply.

But loginUser(nick,pass,chan,true) isn't working for me.

This is my specific problem.

There are 3 users a,b and c

"a" logs in using a user name,then "b" logs in with the same user name,"a" successfully gets kicked out.

Now "c" tries to login with same user name,and "b" doesn't get logged out.Suppose their is some kinda avatar associated with each username,both "b" and "c" can see their avatars on the screen.However only the last logged in user is able to move his avatar around.

What might be happening?



Posted: 18 Oct 2011, 03:34
by harsha
Can anyone please try helping me out..?

Posted: 18 Oct 2011, 16:59
by BigFIsh
What is your SmartFoxServer and Client API version?

Server Version

Posted: 19 Oct 2011, 05:00
by harsha
It's SmartFoxServer PRO v 1.6.6.

Posted: 19 Oct 2011, 21:11
by BigFIsh
Could you please try upgrading to SFS Pro v 1.6.9 (Patch) and see if this resolves the problem.


Posted: 20 Oct 2011, 05:34
by harsha
Hi BigFish,

For upgrading from 1.6.6 to 1.6.9,will there be any major code changes I'll need to make.

Also,do I need to make any changes to the server hardware configuration.

Or is it possible that I can make changes only to that part of the code which deals with loginUser method and retain the rest as is?


Posted: 20 Oct 2011, 19:12
by BigFIsh
I believe patching from 1.6.6 to 1.6.9 won't require any change in your code.

Refer to these patch notes:
1.6.7: viewtopic.php?t=6006
1.6.8: viewtopic.php?t=6474
1.6.9: viewtopic.php?t=8233

Also, you might want to consider this patch as well:
Client API 1.6.3: viewtopic.php?t=7543