Get user online status?

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

Moderators: Lapo, Bax

Aiidenb
Posts: 263
Joined: 16 Aug 2010, 22:08
Location: England
Contact:

Get user online status?

Postby Aiidenb » 05 Apr 2014, 15:53

Hello, i've recently developed my own buddy list, using PHP and mySQL database arrays.
I need to get a users online status, is there a possible way to do this from just a users username?

I'm using SmartFoxServer 1.x, Flash AS2. :D

I created this piece of code.
i[user] is the username.

Code: Select all

for (var user in i) {
myBuddy.push(i[user]);
var buddy:Object = i[user]
trace("Userid: "+buddy.id);
trace("User name: "+buddy.name);
trace("Is user online? "+buddy.isOnline ? "Yes" : "No");
}

However, all I receive from that is

Code: Select all

Userid: undefined
User name: undefined


Am I missing something out?

Thanks for your help! :)
Quackbay - The online virtual world for kids!
Aiidenb
Posts: 263
Joined: 16 Aug 2010, 22:08
Location: England
Contact:

Re: Get user online status?

Postby Aiidenb » 07 Apr 2014, 14:32

Anyone?:(
Quackbay - The online virtual world for kids!
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Get user online status?

Postby Bax » 08 Apr 2014, 08:07

Code: Select all

var buddy:Object = i[user]

If "i[user]" is a username as you stated, then with the above code "buddy" is a String... how do you expect that calling buddy.id or buddy.name returns anything? :)
From your post it seems you are not using the default buddy system available in SFS Pro: http://www.smartfoxserver.com/docs/1x/d ... yList2.htm
If you created your own system you have to implement your own way to check if a buddy is online too.
Paolo Bax
The SmartFoxServer Team

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 38 guests