where does smartfox know myname?

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

Moderators: Lapo, Bax

alvin3343
Posts: 80
Joined: 24 Jan 2006, 09:37

where does smartfox know myname?

Postby alvin3343 » 24 Jan 2006, 09:54

I login in server-side extension and join in client using
"smartfox.joinRoom()".

On onJoinRoom event,I can get my name by "user.getName()".
,but I don't pass my name to smartfox.
Following is what I passed ( server side code if loing is ok):


var user=_server.instance.getUersByChannel(chan);
response._cmd="logOK";
resopnse.name=user.getName();
resopnse.uId=user.getUserId();


I pass these two var to my client and store them in _global vars.

My question is why can smartfox know myName when I
join a room?
How does smarfox to know that?

Thank You for replying.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 24 Jan 2006, 16:52

Hello alvin3343 :)

I am not sure if I understand your question.
Your nickname is stored by the server when you login. I don't understanand what you need to do with it?

Can you reformulate your question?

Thanks :)
Lapo
--
gotoAndPlay()
...addicted to flash games
alvin3343
Posts: 80
Joined: 24 Jan 2006, 09:37

Hello Lapo,

Postby alvin3343 » 27 Jan 2006, 00:07

I mean I use a server side extension to login.
In that case , will smartfoxclient have my data?
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 27 Jan 2006, 08:02

your data?!
I am sorry I still don't get it :)

You posted this code:

Code: Select all

var user=_server.instance.getUersByChannel(chan);
response._cmd="logOK";
resopnse.name=user.getName();
resopnse.uId=user.getUserId();


(ATTENTION: you declared a var called "response" and the you mis-typed it "resopnse")

By using the above code you're sending back to the client the two most important informations that the client should know: the user id and the nickname

What other data do you need?
Lapo

--

gotoAndPlay()

...addicted to flash games
alvin3343
Posts: 80
Joined: 24 Jan 2006, 09:37

Postby alvin3343 » 29 Jan 2006, 10:40

Hello Lapo,

I understand.
Thank you.
Because I login in server side ,so smartfoxclient doesn't have myId and myName .
But it still has other properties like playerId,activeRoomId..
so I confused.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 01 Feb 2006, 14:49

alvin3343 wrote:Hello Lapo,

I understand.
Thank you.
Because I login in server side ,so smartfoxclient doesn't have myId and myName .
But it still has other properties like playerId,activeRoomId..
so I confused.


Yes, that's correct. You don't have them automatically but you can send them from the server side to the client.

Hope I made myself clear :)
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
goodguy20k
Posts: 71
Joined: 10 Jan 2006, 23:58
Location: Texas, USA
Contact:

Postby goodguy20k » 03 Mar 2006, 15:19

I would much prefer to have the default variables set then pass my own and have to use them. Can I perform a action to set the myUserId and myUserName? I've found the closer I stick to your variable names, the better my programs come out. :)
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 03 Mar 2006, 15:25

You can send whatever variables from the server side and have the client handler assign them to _global.myUserId and _global.myUserName ... or so... :) Whatever naming convention would be okay
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 74 guests