set uservariable in loginEventHandler

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

arash
Posts: 14
Joined: 06 Jul 2014, 10:36

set uservariable in loginEventHandler

Postby arash » 06 Oct 2014, 13:44

Hi , I wrote an extension that has Custom Login Handler , after I query my db by use of dbmanager in LoginEventHandler I have some result for this user from db , I have to save some of the result column in uservariable but in LoginEventhandler phase we do not have a real user , how we can transfer this result data to zonejoinHandler so after user creates we can set it's userVariable .
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: set uservariable in loginEventHandler

Postby Lapo » 06 Oct 2014, 17:07

Hello,
you can store the data to be later saved into UserVariables in the session object that is passed to the Login handler.
The session object has a getProperty(key) and a setProperty(key, value) methods.

When the User has finally entered the system you will receive the USER_JOIN_ZONE event which will provide the User object, this time.
From there you go:

Code: Select all

user.getSession().getProperty(...)

... and proceed with setting the User Variables.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
arash
Posts: 14
Joined: 06 Jul 2014, 10:36

Re: set uservariable in loginEventHandler

Postby arash » 08 Oct 2014, 08:44

thx Lapo it works now :)

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 58 guests