Levels

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

Moderators: Lapo, Bax

Guy71173cp
Posts: 148
Joined: 03 Aug 2010, 16:08
Contact:

Levels

Postby Guy71173cp » 06 Sep 2011, 21:24

Hello.

I am making a virtual world. I have a login database with a login extension. I have a row called level and the default value is 1. In my virtual world file, there is a text with an instance name. Is it possible to send the data from the database from the level row to the text? Would I have to add something to the extension? Thanks.
User avatar
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Postby BigFIsh » 07 Sep 2011, 07:42

There's _server.writeFile method which can be used to write the data retrieved from the database to a file.

See http://www.smartfoxserver.com/docs/docPages/serverSideApi/_server/writeFile.htm
Smartfox's forum is my daily newspaper.
Guy71173cp
Posts: 148
Joined: 03 Aug 2010, 16:08
Contact:

Postby Guy71173cp » 07 Sep 2011, 20:11

Hello BigFIsh,

Thanks for the reply. Would I do this through PHP? Is it possible to do it through an H2 Database? Would I use a programming language or normal text file?
User avatar
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Postby BigFIsh » 08 Sep 2011, 04:21

Sorry, but I don't follow. Could you please clearly list down the steps that you require to do (and in order).
Smartfox's forum is my daily newspaper.
Guy71173cp
Posts: 148
Joined: 03 Aug 2010, 16:08
Contact:

Postby Guy71173cp » 08 Sep 2011, 20:37

1. I want the user to login
2. I want the text file to load the user's level from the level row in my H2 database.
3. A text on the chat bar displays what level they are. If they complete a certain quest, the level goes up.
4. The new level is stored in the database, so that the next time the user logs in, their level is the same as when they were logged in the last time.

If I am not explaining this clearly, please tell me.
User avatar
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Postby BigFIsh » 09 Sep 2011, 08:27

Okay, I guess by 'text file' you're referring to the server-side extension.

To do this, you'll need to enable 'custom login' for your zone to be able to handle your own login logic. See http://www.smartfoxserver.com/docs/docPages/tutorials_pro/05_loginExt/index.htm for more on custom login.

As for loading the data from the database, please refer to http://www.smartfoxserver.com/docs/docPages/tutorials_pro/03_dbExt/index.htm%20and and http://www.smartfoxserver.com/docs/docPages/tutorials_pro/19_h2database/index.htm

Then once you have loaded the data, you can then send it to the client after successful login.

Chat bar is for you to figure out.
Smartfox's forum is my daily newspaper.

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 89 guests