|
|
|
|
![]() ![]() |
Feb 18 2008, 09:23 PM
Post
#1
|
|
|
Kinda N00B Group: Members Posts: 230 Joined: 13-January 08 From: Sweden Member No.: 27,579 |
Hey! I know I am asking alot. But much is happening theese days.
Sorry if I disturb with my questions. The thing I am trying to do is: Ex. If the user becomes level 2, he should get 5 skill points. I can't do this: CODE if($userlevel=5){ mysql_query("UPDATE user SET skillpoints =$points+5");} because then it would update everytime the code was loaded. I hope you understand what I am trying to do. If not, tell me Thanks //Feelay |
|
|
|
Feb 19 2008, 04:41 AM
Post
#2
|
|
|
Newbie [ Level 2 ] Group: Members Posts: 23 Joined: 24-October 07 Member No.: 25,689 |
why dont't you add a column to store the last time he was got skill points. Isn't is much easier.
This post has been edited by PerHapsYouSeen: Feb 19 2008, 04:45 AM |
|
|
|
Feb 19 2008, 08:23 AM
Post
#3
|
|
|
PESTICIDAL MANIAC Group: Members Posts: 626 Joined: 1-September 04 From: Auckland, New Zealand Member No.: 27 |
Hey Feelay,
All I noticed is the common mistake with doing comparisons. CODE if($userlevel = 5) is not the same as CODE if($userlevel == 5) The first one is an assignment which means you'll make $userlevel become 5 and will result in true. The second one will not solve the issue though, you really need to do something that PerhapsYouSeen has suggested and add a column to record that they have gotten their points, then you just need to check that first before you give them points. Cheers, MC |
|
|
|
Feb 19 2008, 11:09 AM
Post
#4
|
|
|
Kinda N00B Group: Members Posts: 230 Joined: 13-January 08 From: Sweden Member No.: 27,579 |
sorry
|
|
|
|
Feb 19 2008, 01:29 PM
Post
#5
|
|
|
Way Out Of Control - You need a life :) Group: [MODERATOR] Posts: 2,042 Joined: 16-August 05 Member No.: 7,896 |
|
|
|
|
Feb 19 2008, 04:15 PM
Post
#6
|
|
|
Kinda N00B Group: Members Posts: 230 Joined: 13-January 08 From: Sweden Member No.: 27,579 |
Oh. but my code was just an example.
I just wanted to show, that if I wrote that code, it would give the user 5 skill points every time the page was loaded. but I want it to give the user 5 skill points, only the moment the user reach level 5 (for ex.). and between, I thougt of making a colum for the points, but the user will be able to "buy" health and strenght and stuff for theese points. so they (the points) will become 0 anyway =S This post has been edited by Feelay: Feb 19 2008, 04:18 PM |
|
|
|
Feb 19 2008, 06:02 PM
Post
#7
|
|
|
Nenad Bozidarevic Group: [MODERATOR] Posts: 1,013 Joined: 7-November 05 From: Belgrade, Serbia Member No.: 9,500 |
You have a script that increases a player's level if a condition is fulfilled, right? So why not just increase the points at the sime time you increase his/hers level?
|
|
|
|
Feb 19 2008, 08:10 PM
Post
#8
|
|
|
Kinda N00B Group: Members Posts: 230 Joined: 13-January 08 From: Sweden Member No.: 27,579 |
because the script says:
If the user exp is more than 100, the user level should be changed to level 2 (etc.).. And that script runs everytime the user login. It would not work. |
|
|
|
Feb 19 2008, 10:01 PM
Post
#9
|
|
|
Way Out Of Control - You need a life :) Group: [MODERATOR] Posts: 2,042 Joined: 16-August 05 Member No.: 7,896 |
OK, it seems that you definitively need a user status column in a table. With a value like "3065" if the user is at level 3 and has 65 lifehalth points. Or value 4100 if level 4 with 100 points. You change this value only once (when he goes to level 5) and you read the value each time the player logs in.
|
|
|
|
Feb 19 2008, 10:59 PM
Post
#10
|
|
|
Nenad Bozidarevic Group: [MODERATOR] Posts: 1,013 Joined: 7-November 05 From: Belgrade, Serbia Member No.: 9,500 |
because the script says: If the user exp is more than 100, the user level should be changed to level 2 (etc.).. And that script runs everytime the user login. It would not work. Why not "If the user exp is more than 100, the user level should be changed to level 2, and the user should get skill points (etc.).."? |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 11th October 2008 - 07:58 AM |