kickUser not working

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

harsha
Posts: 5
Joined: 19 Aug 2011, 08:26
Location: India

kickUser not working

Postby harsha » 19 Aug 2011, 09:35

Hi,

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
            
         }
         else
         {
            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 :)
When the going gets weird , the weird turns pro...
User avatar
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Postby BigFIsh » 19 Aug 2011, 21:24

You seem to be doing it the hard way. There's an easier way to do it. Use 'forceLogin'. See http://www.smartfoxserver.com/docs/docPages/serverSideApi/index.htm. It will automatically disconnect the first user when a second user tries to log in with the same username.
Smartfox's forum is my daily newspaper.
harsha
Posts: 5
Joined: 19 Aug 2011, 08:26
Location: India

Postby harsha » 11 Oct 2011, 08:02

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?

Thanks,
Harsha
When the going gets weird , the weird turns pro...
harsha
Posts: 5
Joined: 19 Aug 2011, 08:26
Location: India

Hi

Postby harsha » 18 Oct 2011, 03:34

Can anyone please try helping me out..?
When the going gets weird , the weird turns pro...
User avatar
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Postby BigFIsh » 18 Oct 2011, 16:59

What is your SmartFoxServer and Client API version?
Smartfox's forum is my daily newspaper.
harsha
Posts: 5
Joined: 19 Aug 2011, 08:26
Location: India

Server Version

Postby harsha » 19 Oct 2011, 05:00

It's SmartFoxServer PRO v 1.6.6.
When the going gets weird , the weird turns pro...
User avatar
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Postby BigFIsh » 19 Oct 2011, 21:11

Could you please try upgrading to SFS Pro v 1.6.9 (Patch) and see if this resolves the problem.
Smartfox's forum is my daily newspaper.
harsha
Posts: 5
Joined: 19 Aug 2011, 08:26
Location: India

Hi

Postby harsha » 20 Oct 2011, 05:34

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?

Thanks!
When the going gets weird , the weird turns pro...
User avatar
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Postby BigFIsh » 20 Oct 2011, 19:12

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
Smartfox's forum is my daily newspaper.

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: Google [Bot] and 18 guests