Buddies and Database...

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

Moderators: Lapo, Bax

poppop
Posts: 57
Joined: 07 Jul 2007, 10:24

Buddies and Database...

Postby poppop » 13 Nov 2007, 20:22

Hi Lapo,

I've searched through the forum, and see this has been asked before.

Basically, i want to make a "buddies" and "blocked" list.

Instead of using the built in buddie list system, i stored a list of names in the database, and loaded them into a persons "uVars.myBuddies"

Once the server has sent it into the client, it is stored clientside, and the uservar is not requested again (for bandwidth) (_root.MyBuddies = uVars.myBuddies)

The "Blocked" list works the same way.


What i was planning on doing, was when a user joins, just looping through the "_root.MyBuddies[]" array to see if the person is my buddy.

BUT, i cannot seem to find a way of getting the event of a new user joining the application. I see OnJoinRoom, but no, OnJoinGame type thing.

Any advice??? if i can get somthing like this for join game, and quit game, i think i can work the rest out.

Cheers.
User avatar
alcho
Posts: 84
Joined: 02 Dec 2006, 19:37
Location: UK
Contact:

Postby alcho » 13 Nov 2007, 21:17

What about onUserEnterRoom()

This handler will fire everytime a user joins the room. So you can have

onUserEnterRoom(roomId:Number, userObj:Object)
{
// cycle through buddie list
}

and there is a onUserLeaveRoom too!

Hope this helps
Its all about the SmartFox!
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 14 Nov 2007, 07:21

For your information... SmartFoxServer 1.6 will provide a way more advanced buddy list framework, allowing database persistence, online and offline buddy variables, block list, add-buddy-permissions and more ... all out of the box 8) :)

We're working hard at it and we expect to release it within this month.

stay tuned ;)
Lapo
--
gotoAndPlay()
...addicted to flash games
poppop
Posts: 57
Joined: 07 Jul 2007, 10:24

Postby poppop » 15 Nov 2007, 18:08

alcho wrote:What about onUserEnterRoom()


I've actually found a better way to do the "on user enter game" -- and that's through this (example):

Code: Select all

function handleInternalEvent(evt) {
if(evt.name == "userJoin"){
var u = evt.user
var un = u.getName();
var uid = u.getUserId();   
}
}


The problem is, when the user comes to leave, the HandleInternalEvent gives an error, as it cannot get the "u.getName"

Any ideas???

Then, all i need to do, is send EVERY user in the zone, the persons name... So i need to know how to do that, but i'm sure thats been asked before, so i'll search that.

Any ideas why i cannot get the name of the person who's quit through the ext???

Cheers.





Lapo -- a more advanced buddies system would be great! -- cannot wait for the update :lol:
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 16 Nov 2007, 06:22

I think it depends on the Server version being used.
The User object is passed in that event only since version 1.5.8.
Before that you received its userId
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 64 guests