
newttster
Members-
Posts
513 -
Joined
-
Last visited
-
Days Won
14
Content Type
Profiles
Forums
Events
Everything posted by newttster
-
function check_level() { global $db; global $ir,$c,$userid; $ir['exp_needed']= ($ir['level']*75); if ($ir['exp'] >= $ir['exp_needed']) { /* This table has the users id, level (the level that they were at the last time they completed a trial). It is updated when a user completes the trial for that level. The remaining fields are the trials they have completed. This table gets updated when they have completed a trial. I am selecting the last known level that was posted to the table. If the last level posted in trialstable is less than the next $ir['level'] then they cannot advance. */ $trialcheck=$db->query("SELECT `level` FROM `trialstable` WHERE `userid`='{$ir['userid']}'"); $r=$db->fetch_row($trialcheck); if (($r['level'])<($ir['level']+1)) /* I am echoing something here to let the user know that if they have not completed the trial for this level, then they will not advance level, as well as certain funtions in the game being locked to them. */ { echo'You have not completed the trial for this level.<br /> In order to advance to the next level you must do so.<br /> Please see the Help Tutorial for further information.<br /><br /> <a href="helptutorial.php">Help Tutorial</a><br />'; $h->endpage(); exit; } else { $expu=$ir['exp']-$ir['exp_needed']; $ir['level']+=1; $ir['exp']=$expu; $ir['energy']+=2; $ir['brave']+=2; $ir['maxenergy']+=2; $ir['maxbrave']+=2; $ir['hp']+=50; $ir['maxhp']+=50; $ir['exp_needed']=(int) ($ir['level']*75); $db->query("UPDATE `users` SET `level`=`level`+'1',`exp`='$expu',`energy`=`energy`+'2',`brave`=`brave`+'2',`maxenergy`=`maxenergy`+'2', `maxbrave`=`maxbrave`+'2',`hp`=`hp`+'50',`maxhp`=`maxhp`+'50' WHERE `userid`='{$ir['userid']}'"); } } } The only output that I can see that is happening is that it is adding the exp gained to the db.
-
The code is there ... or atleast it is showing for me when I load this page.
-
I have 3 problems with the code below and I can't figure out why they aren't updating the way they should. 1. It isn't doing the level check from the trialstable. 2. It does not advance the $ir['level'] if the condition is true but it does add the exp gained. 3. When it adds the exp, it does not add the correct amount. It is not subtracting the needed from the actual. function check_level() { global $db; global $ir,$c,$userid; $ir['exp_needed']=(int) ($ir['level']*75); if ($ir['exp'] >= $ir['exp_needed']) { $trialcheck=$db->query("SELECT `level` FROM `trialstable` WHERE `userid`='{$ir['userid']}'"); $r=$db->fetch_row($trialcheck); if (($r['level'])<($ir['level']+1)) { echo'blah blah'; } else { $expu=$ir['exp']-$ir['exp_needed']; $ir['level']+=1; $ir['exp']=$expu; $ir['energy']+=2; $ir['brave']+=2; $ir['maxenergy']+=2; $ir['maxbrave']+=2; $ir['hp']+=50; $ir['maxhp']+=50; $ir['exp_needed']=(int) ($ir['level']*75); $db->query("UPDATE `users` SET `level`=`level`+'1',`exp`='$expu',`energy`=`energy`+'2',`brave`=`brave`+'2',`maxenergy`=`maxenergy`+'2', `maxbrave`=`maxbrave`+'2',`hp`=`hp`+'50',`maxhp`=`maxhp`+'50' WHERE `userid`='{$ir['userid']}'"); } } }
-
11. Daily chores that take longer than 5 minutes to do.
-
How much disc space/bandwidth does the minute cron take up?
newttster replied to LearningCoder's topic in General Discussion
@ Ruler ...By that do you mean ... if you know for a fact that the int that you will have will only be say the number 12 you would use tinyint(2) ... that kind of thing? @ SRB ... I'm not sure what you mean by indices??? -
How much disc space/bandwidth does the minute cron take up?
newttster replied to LearningCoder's topic in General Discussion
That's a question ... how do you optimize a query? Do you mean specifying the field you want as opposed to using the asterisk to pull your data? How do you know when it is optimized? What steps can you take to optimize them? One thing that I have been doing is reducing the size of my users table. I think it has helped. -
How much disc space/bandwidth does the minute cron take up?
newttster replied to LearningCoder's topic in General Discussion
Out of the box with no modifications done to them ... the actual file size for all 4 of them is 11 kb. Bandwidth to run them ... no idea. -
This is not the first time that there has been a complaint about Skooda/Alonzo ... somehow doubt it will be the last. http://makewebgames.io/showthread.php/41270-Alonzo-Rucker-Experience
-
Why are you saying "you" as if you are implying that I copied something from you. I don't even have a game up and running as of yet. There has been a long standing discussion amongst certain sites that the owners of Immortal Night have tried to get some games removed with some success, what the reasons were for it is not really my concern. That is all I was stating. Having said that, Immortal Night appears to be doing quite well for itself. @ SRB ... who is Josh? And are you referring to me or STD as being Josh or myself?
-
We all know that some people have run into problems with the "owners" of this game. Meaning that they have tried to get others (succeeded in some cases) taken down because of so called copyright infringement etc.. That having been said, Immortal Night seems to be doing alright for itself as well as Reign of Blood.
-
Saying it doesn't work is not going to help anyone help you. What error messages are you getting? What version of McCodes are you using? That kind of thing.
-
ruler ... I didn't say whether I think it's a good idea or not ... I put it forth as an option. Think of it this way though ... you have player A who has maxed account and has huge resources available to them due to their level, good planning, whatever ... then comes along player B who just started the game and has nothing ... then player A gives player B all kinds of resources to become an "uber" player without having done anything on their own to accomplish that ... how is that a good idea or not? How is that fair to any other new sign up? Either way you look at it ... it is always going to be a balancing act between what is considered cheating and what is not ... from your perspective as the owner and the players perspective.
-
I understand that, but how will it post anything if it is trying to execute both at the same time. Does that make sense or am I just not understanding the way an if/else works?
-
ruler ... where did I say you have to ask admin every time you wish to do something. I only said you have to ask if you want to send a gift ... that's a big difference. Nor does it answer whether or not the other options that I suggested are viable or not.
-
Can you not stop this by simply removing any of the "send" options, as well as putting a cap (low/high) on your "sell" prices in any of your player markets? And if by chance player A wants to send a gift of 100 crystals to player B they need admin permission to do so.
-
It looks to me like you are trying to print both conditions to their profile. Don't you need an "else" in there? I could be wrong, of course. If (yada yada) { print "whatever" } else { print "whatever" }
-
Bot detect mod request (Will pay)
newttster replied to Hendrickson's topic in Requests & In Production
Just another option to look at; Is limiting the number of crimes a player can do during any reset period. X number for donators, X number for nondonators. You can further that by limiting the number of times they can refill "brave" or whatever resource is used as well. -
In order to get help, you need to explain what exactly you are having a problem with. What error message are you getting? etc.
-
Although I agree with you to a certain extent ... there is a large portion of people who learn better by having an example of something that has already been done to refer to than trying to create something from nothing. I am one of those people. I like having an example to work from so that I can (in most cases) follow the logic. Admittedly there are times obviously that I get stuck on something that I just can't see. (Right Ruler?) That's what I come here for ... when I get really stuck and I am missing the obvious when it has been staring me in the face for the last 3 days. The people on here will for the most part give you what you are looking for or point you in the right direction. If it were not for the help I have recieved here from some really great people I would have given up long ago. I personally don't see anything wrong with learning as you go. Nor do I see much sense in recreating the wheel when it has already been done. What I do like to do (or try to do) is make the wheel look even better. Am I succeeding in that. *shrugs* Only time will tell.
-
Got it. Thanks so much for everyone's input ... and sorry for having wasted your time on this.
-
*facepalms* I do now. Grr! So as long as I do one INSERT query to start that contains the users ID ... after that I can simply do an UPDATE from then on? My apologies ... that completely got by me all together. Colour me embarassed.
-
Okay everyone ... I have tried all of your suggestions and it still will not post to the db. It does not give me an error message. @ruler - I did as you suggested and all it is doing is printing out is a 1 after the <a href='explore.php'>Back to town<a/>"; @sniko - I encase the values because every once in a while the query that I am attempting to do will not recognize it without the quotes. So as a fail safe, I always do this now. *shrugs* I have thought of doing an INSERT INTO ... the problem with that is there will come a time when the table itself will have too many rows to make this feasible ... which is why I am trying to get the UPDATE to work. EDIT: On reflection, with the INSERT INTO after the userid value the rest would just be 0 or 1. This does work as I have tested it ... it's just that after a certain point doing the INSERT with all the 1's and 0's will get annoying which is why I was trying to get the UPDATE to work. Which would you use?
-
Why is this not posting to the database? I have verified that all the names in the table and the table name itself are correct. Default for "grosetonesone" is 0. Type is tinyint-2. function tonestage_one() { global $db,$ir,$c,$userid,$h; $q=$db->query("SELECT grosetonesone FROM stagetable WHERE userid = {$ir['userid']}"); $r=$db->fetch_row($q); if ($r['grosetonesone']==0) { echo "Yada yada yada blah blah blah.<br /> <a href='explore.php'>Back to town<a/><br />"; $db->query("UPDATE `stagetable` SET `grosetonesone`= '1' WHERE `userid`='{$ir['userid']}'", $c); } else { echo"Why are you here? You have already done this."; } }
-
Thank you both for your input on this. Appreciate it so much. You ever had one of those days when all you do is bang your head against a wall and nothing shakes out. It's one of those "scripting" days for me. Thanks again.
-
So if I follow that correctly; if($ir['location']==2) { echo"<a href='roulette.php'> Roulette</a><br />"; } else { echo"You cannot play Roulette in this city.<br /> <a href='explore.php'>Back</a><br />"; }