You are not logged in.

wrx

Intermediate

  • "wrx" started this thread

Posts: 209

Activitypoints: 1,145

Level: 23 [?]

Experience: 56.786

Next Level: 62.494

  • Send private message

1

Saturday, July 31st 2010, 3:52am

PLAYER_STATS table

im adding a demo account to develop with. after registering no player stats were created. Should i just set up the SQL here in the register.php to populate the PLAYER_STAS table or is it elsewhere as i might be missing something .

PHP Source code

1
2
3
4
5
6
7
8
9
10
11
else // Doesn't exists we can create the account
        {
            $pass=md5(strip($_POST["PASSWORD"]));
            $sql="INSERT INTO PLAYERS(USERNAME,PASSWORD,EMAIL,AUTHORIZED) VALUES(".
            $db->qstr(strip($_POST["USERNAME"])).",".$db->qstr($pass).",".
            $db->qstr(strip($_POST["EMAIL"])).",'Y')";
            echo $sql;
            $db->Execute($sql);
            setcookie("ZAPLOGIN",$db->getid()."/".md5($pass.$_SERVER["REMOTE_ADDR"]));
            header("Location: world.php");
            return;






wrx

wrx

Intermediate

  • "wrx" started this thread

Posts: 209

Activitypoints: 1,145

Level: 23 [?]

Experience: 56.786

Next Level: 62.494

  • Send private message

2

Saturday, July 31st 2010, 5:38am

PHP Source code

1
2
3
4
5
// Create player stats (level)
            $id=$db->getid();
             $sql="INSERT INTO PLAYER_STATS(USERID,STATID,VALUE) VALUES(".$id.",'1','1')";
            echo $sql;
            $db->Execute($sql);

a_bertrand

Administrator

  • "a_bertrand" is male

Posts: 861

Activitypoints: 4,545

Location: Switzerland

Level: 37 [?]

Experience: 1.062.305

Next Level: 1.209.937

  • Send private message

3

Saturday, July 31st 2010, 5:43am

If I remember right, the player stats are created when needed not before.

wrx

Intermediate

  • "wrx" started this thread

Posts: 209

Activitypoints: 1,145

Level: 23 [?]

Experience: 56.786

Next Level: 62.494

  • Send private message

4

Saturday, July 31st 2010, 5:52am

after creating a new user it was unable to work or train as nothing was being added to the PLAYER_STATS table.

a_bertrand

Administrator

  • "a_bertrand" is male

Posts: 861

Activitypoints: 4,545

Location: Switzerland

Level: 37 [?]

Experience: 1.062.305

Next Level: 1.209.937

  • Send private message

5

Monday, August 2nd 2010, 1:07pm

Stats are handled for you. So you should just do something like:

PHP Source code

1
set_stat("MYSTAT",100);

and that should be set.
BTW before using a stat make sure it is defined in the admin panel or directly in the table STATS

the function set_stat will change the value in memory and at the end of the page the function flush_stats will be called and actually save the new values.

wrx

Intermediate

  • "wrx" started this thread

Posts: 209

Activitypoints: 1,145

Level: 23 [?]

Experience: 56.786

Next Level: 62.494

  • Send private message

6

Monday, August 2nd 2010, 7:40pm

Stats are handled for you. So you should just do something like:

PHP Source code

1
set_stat("MYSTAT",100);

and that should be set.


yes i see that function being used in modules/locations/train/train.php


BTW before using a stat make sure it is defined in the admin panel or directly in the table STATS

the function set_stat will change the value in memory and at the end of the page the function flush_stats will be called and actually save the new values.


I have seen the stats in the table, im not creating anything new yet just looking at what exists. With the exception of the admin account that was created during the install it populated the PLAYER_STATS table. When creating new users it does not create any rows in the PLAYER_STATS table so that user can not train or work because they don't not have any strength,money or energy.

{{quickstats}} is blank as well as it pulls from the PLAYER_STATS table

This post has been edited 1 times, last edit by "wrx" (Aug 2nd 2010, 7:48pm)


wrx

Intermediate

  • "wrx" started this thread

Posts: 209

Activitypoints: 1,145

Level: 23 [?]

Experience: 56.786

Next Level: 62.494

  • Send private message

7

Monday, August 2nd 2010, 8:30pm

these are the errors that occour when going to modules/location/train/train.php

Quoted

Notice: Undefined index: energy in /zapengine/libs/misc_util.php on line 248

Notice: Undefined index: SHORT in /zapengine/modules/interface/quickstats/quickstats.php on line 5
:44

Notice: Undefined index: money in /zapengine/libs/misc_util.php on line 248


and error that occours when going to module/location/work/work.php

Quoted

Notice: Undefined index: energy in /zapengine/libs/misc_util.php on line 248

Djkanna

Professional

  • "Djkanna" is male

Posts: 1,108

Activitypoints: 5,820

Location: United Kingdom.

Occupation: Freelance

Level: 36 [?]

Experience: 847.245

Next Level: 1.000.000

  • Send private message

8

Tuesday, August 3rd 2010, 12:27am

Not so much error more of a notice :P

Lemme get another copy of Zap and put it online see what happens :)
"....I'm saying you've already done plenty of things to regret, you just don't know what they are. It's when you discover them, when you see the folly in something you've done, and you wish that you had it do over, but you know you can't, because it's too late. So you pick that thing up, and carry it with you to remind you that life goes on, the world will spin without you, you really don't matter in the end. Then you will gain character, because honesty will reach out from inside and tattoo itself across your face."

CrimGame||MrDjk || Web.DeveRz :thumbsup: 8o
I think you scare me 0_o

wrx

Intermediate

  • "wrx" started this thread

Posts: 209

Activitypoints: 1,145

Level: 23 [?]

Experience: 56.786

Next Level: 62.494

  • Send private message

9

Tuesday, August 3rd 2010, 1:30am

Lemme get another copy of Zap and put it online see what happens :)


ok cool everthing was working as intended until i created a new user and thats when i started seeing all the "Notices"







wrx

Djkanna

Professional

  • "Djkanna" is male

Posts: 1,108

Activitypoints: 5,820

Location: United Kingdom.

Occupation: Freelance

Level: 36 [?]

Experience: 847.245

Next Level: 1.000.000

  • Send private message

10

Tuesday, August 3rd 2010, 1:41am

Yeah you're right a few notices here and there but nothing major sort of speak. It's just in need of a little TLC :D
"....I'm saying you've already done plenty of things to regret, you just don't know what they are. It's when you discover them, when you see the folly in something you've done, and you wish that you had it do over, but you know you can't, because it's too late. So you pick that thing up, and carry it with you to remind you that life goes on, the world will spin without you, you really don't matter in the end. Then you will gain character, because honesty will reach out from inside and tattoo itself across your face."

CrimGame||MrDjk || Web.DeveRz :thumbsup: 8o
I think you scare me 0_o

a_bertrand

Administrator

  • "a_bertrand" is male

Posts: 861

Activitypoints: 4,545

Location: Switzerland

Level: 37 [?]

Experience: 1.062.305

Next Level: 1.209.937

  • Send private message

11

Thursday, August 5th 2010, 9:50am

Ok I solved the issue. There was indeed a bug in the query which was retrieving the stats. Now this issue should be gone.
At the same time I solved the issue with the strict warning about the timezone function.

wrx

Intermediate

  • "wrx" started this thread

Posts: 209

Activitypoints: 1,145

Level: 23 [?]

Experience: 56.786

Next Level: 62.494

  • Send private message

12

Thursday, August 5th 2010, 5:57pm

Thanks for taking the time Alain to look at this, i'll refresh shortly.

What file had the bad query ?( i would like to see it as I was unable to drill it down myself)

thanks again.



update: nvm i see the changelog entry for misc_util.php



wrx

This post has been edited 1 times, last edit by "wrx" (Aug 5th 2010, 6:13pm)


Similar threads