Jump to content
MakeWebGames

newttster

Members
  • Posts

    513
  • Joined

  • Last visited

  • Days Won

    14

Everything posted by newttster

  1. In your tables change int(11) to bigint(20). The number will not go on forever but it will give you a much larger number to work with that int(11) would.
  2. Tables are used to store data in your database. If you don't know what the users table is ... I'm not sure how much help anyone can be. Generally speaking when you get the error that states unexpected end that means that you have forgotten a close bracket ... either () or {}. You would have had to append your users table to include the "player tag information".
  3. I had already thought of that but that won't work because I have other cyberbanks where the interest rates are different.
  4. Have you updated the users table? When you look at the code ... which line is causing the problem? Are you actually typing anything into the text box to make sure that there is something there to change?
  5. Can you post any error messages you are getting ... the code that you used. It is difficult to help when we don't know what is happening.
  6. Okay ... you guys are not going to believe this ... but I actually got it to work. I changed the code just a little and if I'm understanding it ... it is accessing the db just once. Here it is. What do you guys think???   $get = $db->query("SELECT users.userid,inventory.inv_itemid FROM users LEFT JOIN inventory ON users.userid=inventory.inv_userid WHERE inventory.inv_itemid=622 AND inventory.inv_qty>0 AND users.cybermoneyba>0"); $fourperc = array(); #Create an array for later while($r = $db->fetch_row($get)) { $db->query("UPDATE users SET cybermoneyba=cybermoneyba+((cybermoneyba/100)*4) WHERE userid={$r['userid']} AND cybermoneyba>0 AND cybermoneyba<10000000"); #Add 4% interest array_push($fourperc, $r['userid']); #Add to the array of people who have 4% increase } if (!in_array(($r['userid']),$fourperc)) { $db->query("UPDATE users SET cybermoneyba=cybermoneyba+((cybermoneyba/100)*1) WHERE cybermoneyba >0 AND cybermoneyba<10000000"); #Add 1% interest }   Damn it!! Okay ... I lied. It works to a degree ... what it is doing is adding the 4% to ID's that have item 622 and adding 1% to ID's that do not have item 622 ... but ... then it is adding 1% compunded to the ID's that have item 622. IE: $1,000,000 + 4% =$1,040,000 then it adds 1% to the $1,040,000 giving $1,050,400. It is adding just the 1% to the ID's that do not have the item 622.
  7. Okay ... I have been testing everyone's code that they have posted here or sent me via pm. So far ... the only one that has shown any updating to the db is Sniko's. I made a few changes to the code that he posted. The first have of the code works fine. The second half I am getting an error in relation to the array. <b>QUERY ERROR:</b> You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'in_(Array) AND users.cybermoneyba>0' at line 1<br /> Query was SELECT users.userid,inventory.inv_itemid FROM users LEFT JOIN inventory ON users.userid=inventory.inv_userid WHERE users.userid NOT in_(Array) AND users.cybermoneyba>0 The code that I have is:   $get = $db->query("SELECT users.userid,inventory.inv_itemid FROM users LEFT JOIN inventory ON users.userid=inventory.inv_userid WHERE inventory.inv_itemid=622 AND inventory.inv_qty>0 AND users.cybermoneyba>0")or die(mysql_error()); $fourperc = array(); #Create an array for later while($r = $db->fetch_row($get)) { $db->query("UPDATE users SET cybermoneyba=cybermoneyba+((cybermoneyba/100)*4) WHERE userid={$r['userid']}")or die(mysql_error()); #Add 4% interest array_push($fourperc, $r['userid']); #Add to the array of people who have 4% increase } $get = $db->query("SELECT users.userid,inventory.inv_itemid FROM users LEFT JOIN inventory ON users.userid=inventory.inv_userid WHERE users.userid NOT in_({$fourperc}) AND users.cybermoneyba>0")or die(mysql_error()); while($r = $db->fetch_row($get)) { $db->query("UPDATE users SET cybermoneyba=cybermoneyba*0.1 WHERE userid={$r['userid']}or die(mysql_error())"); #Add 1% interest }   In the meantime ... I will be further testing out Randoms' and Djs' as well. I'm hoping that with a combination of everyones ideas we will be able to come up with a working code that only accesses the db once. *crosses fingers* I am so far into this now that I refuse to give up .... bald or not!!!
  8. I agree with Peter and Bio. If someone is willing to sell you a game that is already up and running (which sounds to me is exactly what you are trying to do/buy) ... you have to ask yourself why they would be selling it so cheap. As Peter and Bio said .. the license for Mccodes alone is $100, then you add in any mods that the person may have bought, hosting fees, etc ... even if they didn't pay for any mods .. you are looking at a great deal of time and effort (in most cases) developing said game. If indeed someone does sell you a game for $100 I would strongly recommend that you check with McCodes to verify that the license that you have purchased is legitimate.
  9. Well ... we all know what a newb I am when it comes to doing various things ... though I am learning day by day. (Thanks everyone) When it came time to move my site from the previous host I was using ... I had aboslutely no clue on how to go about doing so. I contacted Peter and asked him if he would move everything over for me. He did so with no questions asked. He was on MSN and explained what he was doing step by step to me as he was doing it. I had screwed something up with the domain name and Peter helped to correct that by giving me the domain name that I really wanted at no extra charge. How many hosting sites would do that for you? His prices are the best out there as far as I'm concerned. You might be able to get cheaper, but you sure as hell aren't going to get the level of service that you do from Peter. When it comes time to having my templates coded with the css and whatever other stuff needs to be done to make them usable on my site ... I will definitely using Peters' services once again. I strongly recommend Peter to anyone for the services he offers. Thank you, Peter ... for holding my hand every step of the way and answering what I am sure were very stupid questions. For being professional enough to not laugh at me ... though I'm sure there were some eye rolls along the way. *laughs* You da best!!!
  10. I really appreciate that you have both put forth some great ideas. Unfortunately, neither one worked. I am finding this so very frustrating. *Grrrr* I'll keep playing with both ... hopefully something will work soon.
  11. I've tried every which way that I can think of to get this to work and still nothing. Basically if a player has item "622" they will earn 4% interest, if they don't they will earn 1%. Any ideas?     $users=$db->query("SELECT `cybermoneyba` FROM `users` WHERE userid > 0'); $ICStBA=mysql_query("SELECT `inv_qty` FROM `inventory` WHERE `inv_itemid`='622' AND `inv_userid` > 0"); WHILE ($r=$db->fetch_row($ICStBA)) { if (($r['inv_qty']>=1) AND ($users['cybermoneyba']<10000000)) { $db->query("UPDATE users SET cybermoneyba=cybermoneyba+((cybermoneyba/100)*4) WHERE ($r['inv_userid'])= userid"); } else { $db->query("UPDATE users SET cybermoneyba=cybermoneyba+((cybermoneyba/100)*1) WHERE ((cybermoneyba<10000000) AND (userid= ($ir['userid'])))"); } }
  12. Yes. dlevels are 1,2 and 3. That's it.
  13. Thanks everyone for your help. Got it to work finally with your suggestions and some fiddling. It may not be pretty, but it works.   $q2=$db->query("SELECT `dlevel`,`accpoints`,`maxpoints` FROM `users` WHERE `userid` > 0"); WHILE ($r=$db->fetch_row($q2)) { IF (($r['accpoints'])<= ($r['maxpoints'])) { if ($r['dlevel'] == 1) { $accpointsgain = ($r['accpoints']+300); if ($accpointsgain <= $r['maxpoints']) { $db->query("UPDATE users SET accpoints=$accpointsgain WHERE dlevel=1 AND accpoints<=maxpoints AND userid > 0"); } else { $db->query("UPDATE users SET accpoints={$r['maxpoints']} WHERE dlevel=1 AND accpoints<=maxpoints AND userid > 0"); } } if ($r['dlevel'] == 2) { $accpointsgain2 = ($r['accpoints']+400); if ($accpointsgain2 <= $r['maxpoints']) { $db->query("UPDATE users SET accpoints=$accpointsgain2 WHERE dlevel=2 AND accpoints<=maxpoints AND userid > 0"); } else { $db->query("UPDATE users SET accpoints={$r['maxpoints']} WHERE dlevel=2 AND accpoints<=maxpoints AND userid > 0"); } } if ($r['dlevel'] == 3) { $accpointsgain3 = ($r['accpoints']+500); if ($accpointsgain3 <= $r['maxpoints']) { $db->query("UPDATE users SET accpoints=$accpointsgain3 WHERE dlevel=3 AND accpoints<=maxpoints AND userid > 0"); } else { $db->query("UPDATE users SET accpoints={$r['maxpoints']} WHERE dlevel=3 AND accpoints<=maxpoints AND userid > 0"); } } } }
  14. Here is the scenario. On the users table I have the "maxpoints" set too 7200 for "dlevel" 1, "maxpoints" set too 9600 for "dlevel" 2, "maxpoints" set too 12000 for "dlevel" 3. The problem I am having is that it keeps adding to the "accpoints" and does not stop at the "maxpoints" amount. Here is my code. I've tried a number of ways to get it to stop adding the points. Really stumped on this. Any help would be greatly appreciated.   $q2=$db->query("SELECT dlevel FROM users WHERE userid > 0"); WHILE ($r=$db->fetch_row($q2)) { IF (($r['accpoints'])<= ($r['maxpoints'])) { $db->query("UPDATE users SET accpoints=accpoints+300 WHERE dlevel=1"); $db->query("UPDATE users SET accpoints=accpoints+400 WHERE dlevel=2"); $db->query("UPDATE users SET accpoints=accpoints+500 WHERE dlevel=3"); } ELSE { $db->query("UPDATE users SET accpoints=accpoints+0"); } }   Okay ... I figured that part out by adjusting the code to WHERE dlevel=1 and accpoints<=maxpoints") The next issue I am having is if there are only 99 points or 53 or 210 points to equal the maxpoints ... how would I get it to add that number of points so that it does not exceed the maxpoints. The way the code is now ... it will add the full 300 points if they are a dlevel1. Meaning that if they have 7110 points it will bring the accpoints to 7410 and then stop accumulating points. I want it to just add 90 points so that the accpoints does not exceed the maxpoints of 7200.
  15. Most anyone that is worth anything will want to know how much you are willing to pay. Yet more others will ask that you try to do the mods yourself and will help you if you get stuck. Good Luck!
  16. You know ... I know you have been here for some time ... and most of the time i respect what you have to say. However, it seems that lately every post that I see you make, you are all about negativity and shooting everyone down for their ideas or requests with help. Now I know everyone has the right to post what they wish (within the rules, of course) but damnit man ... if you can't be nice or maybe offer some help, then why even bother posting at all. Is there some kind of reward for the number of posts you make? And yes ... I'm well aware of the irony of making a neagative post about negativity.
  17. How about something like this ; say you want it to go up by 10% per level. exp=(((level*100)*.10)+100)
  18. I'm not 100% certain but I think you have to use whole numbers when adding things via the staff panel.
  19. *facepalms* Thanks for that, Random. Well .. it's back to the drawing board then for me. It's one of those things that is going to drive me nuts until I figure out how to do it right. Thanks everyone for your input so far.
  20. This sounds to me like you are trying to do an "illegal" thing in someone's game to bypass blocks to get more benefits.
  21. Same idea ... sets it to the same increase for all levels. I'm thinking what I might have to do is define a variable for the increase then do that if statement, as you suggested. $increase=(100/$ir['level']); If itmid =x then energy=energy + increase. But I'm still going to end up with a lot of code in the itemuse file ... depending on the number of items that I want to apply this too. I was just hoping that there might be a simpler way of doing this.
  22. I realize that I can do it in the staff_items menu but that would set it too 100% for all levels, does it not?
  23. Well that completely lost me. How would you specify the levels and percentages that way as well as the specific item id?
  24. I've been trying to figure this out for some time now and I'm still stumped on how to do it. For arguements sake ... we'll use an energy item. I have it set up on my staff_items that items can be level specific, which works great if you want the item to be specific to one level. What I can't figure out is how to get any item that can be used by all levels but with different percentages without having to add huge amounts of code to the itemuse file. For example ... an energy item used by a level 1 would give 100% energy whereas if the same item was used by a level 100 it would only give 1%. There has to be an easier way of doing this than adding millions (exaggeration) of lines of code. Any ideas?
  25. newttster

    Variables?

    *nods* I know that as it stands now none of the coding I have done so far is secure. I am waiting until I have everything working the way I want it to, then I will be attacking the security side of it. It will be a while before that comes about though. Hmm ... if worse comes to worst ... I'll hire someone from Danny696's trusted list to help me with the security.
×
×
  • Create New...