-
Posts
1,099 -
Joined
-
Last visited
-
Days Won
3
Content Type
Profiles
Forums
Events
Everything posted by Lithium
-
Re: sql help that seems a phpmyadmin error... if thsat is the case... probably the issue is on the file you are trying to import...
-
mccode-v2 100% Working Copy Enhanced Schooling
Lithium replied to Uridium's topic in Free Modifications
Re: [MCCODES V2] 100% Working Copy Enhanced Schooling One minor attention call... I haven't tested this but for the above code you state... $course=$ir['minus_clicks']; So, wouldn't be more correct to use only $course instead $course['minus_clicks'] ? $course['whatever'] would be the way if you had something like $course = mysql_fetch_array(mysql_query("SELECT field1, field2, field3 FROM users WHERE userid = $userid"); ;) -
Re: [MCCODES V2] New Schooling Advanced On education.php right after this line if($ir['course_clicks'] >= 1) { add something along these lines... if ($ir['cpercent'] == '100') { $db->query("UPDATE users SET `cpercent` = '0' WHERE userid=$userid"); $db->query("UPDATE `coursesdone` WHERE `userid` = '{$userid}' AND `courseid` = '{$ir['course']}' "); print "some rantings on course finished and redirect user to take a new course!"; exit; }
-
As of this, and as MySQL 6 is on the way to be available (stable), and also a few users are already using MySQL 5.1, here it goes a simple replacement example for the 5 minute cron... This is based on the Lite version cron file though with a few tweaks it should suit ANY other version. Let's update users energy DELIMITER $$ CREATE EVENT `energy_update` ON SCHEDULE EVERY 5 MINUTE STARTS '2009-04-29 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO UPDATE `your_db`.`users` SET `energy` = `energy` + ( `maxenergy` /(12.5)) WHERE `energy` < `maxenergy`$$ DELIMITER ; Now let's fix energy if it goes above 100% DELIMITER $$ CREATE EVENT `FIX_energy_update` ON SCHEDULE EVERY 5 MINUTE STARTS '2009-04-29 00:00:01' ON COMPLETION NOT PRESERVE ENABLE DO UPDATE `your_db`.`users` SET `energy` = `maxenergy` WHERE `energy` > `maxenergy`$$ DELIMITER ; Now will update DELIMITER $$ CREATE EVENT `will_update` ON SCHEDULE EVERY 5 MINUTE STARTS '2009-04-29 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO UPDATE `your_db`.`users` SET `will` = `will` + '10' WHERE `will` < `maxwill`$$ DELIMITER ; Now let's fix will if it goes above 100% DELIMITER $$ CREATE EVENT `FIX_will_update` ON SCHEDULE EVERY 5 MINUTE STARTS '2009-04-29 00:00:01' ON COMPLETION NOT PRESERVE ENABLE DO UPDATE `your_db`.`users` SET `will` = `maxwill` WHERE `will` > `maxwill`$$ DELIMITER ; Now brave update DELIMITER $$ CREATE EVENT `brave_update` ON SCHEDULE EVERY 5 MINUTE STARTS '2009-04-29 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO UPDATE `your_db`.`users` SET `brave` = `brave` + ((`maxbrave`/10)+0.5) WHERE `brave` < `maxbrave`$$ DELIMITER ; Now let's fix brave if it goes above 100% DELIMITER $$ CREATE EVENT `FIX_brave_update` ON SCHEDULE EVERY 5 MINUTE STARTS '2009-04-29 00:00:01' ON COMPLETION NOT PRESERVE ENABLE DO UPDATE `your_db`.`users` SET `brave` = `maxbrave` WHERE `brave` > `maxbrave`$$ DELIMITER ; Now health update DELIMITER $$ CREATE EVENT `health_update` ON SCHEDULE EVERY 5 MINUTE STARTS '2009-04-29 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO UPDATE `your_db`.`users` SET `hp` = `hp` + (`maxhp`/3) WHERE `hp` < `maxhp`$$ DELIMITER ; Now let's fix health if it goes above 100% DELIMITER $$ CREATE EVENT `FIX_health_update` ON SCHEDULE EVERY 5 MINUTE STARTS '2009-04-29 00:00:01' ON COMPLETION NOT PRESERVE ENABLE DO UPDATE `your_db`.`users` SET `hp` = `maxhp` WHERE `hp` > `maxhp`$$ DELIMITER ; Now that all events were created, let's enable them... set global event_scheduler = 1; And off you go. A few considerations... As you might have noticed, starting day is past, doing this, after enabling the event_scheduler, will allow you to see changes in a matter of minutes/seconds. Also, the "FIX" events are set to 1 second after the main event trigger, this is just the best choice to fix if values go over 100%. And remember this only works if you have MySQL 5.1 and above, less than that it will simply be useless. Performance on this? Well... see for yourself ;) One last word... these events are ready to be dumped in any MySQL tool (phpmyadmin, toad, etc)
-
Re: [mccode v2] Revamped RentaSpy I'm trying to guess... but you still might have another instances refering to the "rating", if that is it... you will need to remove them as long as you are not using it
-
Re: [mccode v2] Revamped RentaSpy @ Mr.Boss: if you don't have the rating mod installed, simply replace this... $sql = sprintf('SELECT `level`, `username`, `equip_primary`, `equip_secondary`, `equip_armor`, `money`, `rating`, `bankmoney`, `crimexp`, `crystals` FROM `users` WHERE userid = %u', $_GET['ID']); for this... $sql = sprintf('SELECT `level`, `username`, `equip_primary`, `equip_secondary`, `equip_armor`, `money`, `bankmoney`, `crimexp`, `crystals` FROM `users` WHERE userid = %u', $_GET['ID']);
-
Re: [mccode v2] User Shops [$35.00] Check Zero's profile url, he had it running there
-
Re: help with crystal temple untested but it should work... <?php include_once (DIRNAME(__FILE__) . '/globals.php'); ### Start Configuration ### $BraveRefill = '10'; $PowerRefill = '10'; $Buy10steps = '10'; $Sell10steps = '10'; $Money = '1000'; ### End Configuration ### function Error($Message) { global $h; echo sprintf("<span style='color: #FF0000;'>Error! %s</span>", stripslashes($Message)); exit($h->endpage()); } $_GET['spend'] = isset($_GET['spend']) && ctype_alpha($_GET['spend']) ? trim($_GET['spend']) : FALSE; if (!in_array($_GET['spend'], array('', 'BraveR', 'PowerR', 'Buy10s', 'Sell10s', 'Money'))) { Error('Invalid Command!'); } if (!$_GET['spend']) { echo '<span style="text-decoration: underline; font-size: 14px; font-weight: 600">Welcome To The Crystal Temple!</span> '; echo sprintf("You have [b]%s[/b] crystals. ", number_format($ir['crystals'])); echo 'What would you like to spend your crystals on? '; echo sprintf(" [url='ctemple.php?spend=BraveR'] BraveRefill - %s Crystals[/url] ", number_format($BraveRefill)); echo sprintf("[url='ctemple.php?spend=PowerR']Power Refill - %s Crystals[/url] ", number_format($PowerRefill)); echo sprintf("[url='ctemple.php?spend=Buy10s']Buy 10 Steps - %s Crystals[/url] ", number_format($Buy10steps)); echo sprintf("[url='ctemple.php?spend=Sell10s']Sell 10 Steps - %s Crystals[/url] ", number_format($Sell10steps)); echo sprintf("[url='ctemple.php?spend=Money']Money - $%s Per Crystal [/url] ", number_format($Money)); } else { if ($_GET['spend'] == 'BraveR') { if ($ir['crystals'] < $BraveRefill) { Error('You Don\'t Have Enough Crystals!'); } else if ($ir['brave'] == $ir['maxbrave']) { Error('You Already Have Full Brave.'); } else { $db->query(sprintf("UPDATE users SET brave=maxbrave, crystals=crystals-%d WHERE userid=%d", $BraveRefill, $userid)); echo sprintf("You Have Paid %d Crystals To Refill Your Brave Bar.", number_format($BraveRefill)); } } else if ($_GET['spend'] == 'PowerR') { if ($ir['crystals'] < $PowerRefill) { Error('You Don\'t Have Enough Crystals!'); } else if ($ir['will'] == $ir['maxwill']) { Error('You Already Have Full Power.'); } else { $db->query(sprintf("UPDATE users SET will=maxwill, crystals=crystals-%d WHERE userid=%d", $PowerRefill, $userid)); echo sprintf("You Have Paid %d Crystals To Refill Your Power Bar.", number_format($PowerRefill)); } } else if ($_GET['spend'] == 'Buy10s') { if ($ir['crystals'] < $Buy10steps) { Error('You Don\'t Have Enough Crystals!'); } else { $db->query(sprintf("UPDATE users SET turns=turns+10, crystals=crystals-%d WHERE userid=%d", $Buy10steps, $userid)); echo sprintf("You Have Paid %d crystals to get 10 steps at scavanging.", number_format($Buy10steps)); } } else if ($_GET['spend'] == 'Sell10s') { if ($ir['crystals'] < $Sell10steps) { Error('You Don\'t Have Enough Crystals!'); } else { $db->query(sprintf("UPDATE users SET turns=turns-10, crystals=crystals+%d WHERE userid=%d", $Sell10steps, $userid)); echo sprintf("You Have Sold 10 Steps For %d Crystals .", number_format($Sell10steps)); } } else if($_GET['spend'] == 'money') { print "Type in the amount of crystals you want to swap for money. You have [b]{$ir['crystals']}[/b] crystals. One crystal = \$". number_format($Money).".<form action='ctemple.php?spend=Money2' method='post'><input type='text' name='crystals' /> <input type='submit' value='Swap' /></form>"; } else if($_GET['spend'] == 'money2') { $_POST['crystals']=(int) $_POST['crystals']; if($_POST['crystals'] <= 0 || $_POST['crystals'] > $ir['crystals']) { print "Error, you either do not have enough crystals or did not fill out the form. [url='ctemple.php?spend=Money']Back[/url]"; } else { $gain=$_POST['crystals']* $Money; $db->query("UPDATE users SET crystals=crystals-{$_POST['crystals']},money=money+$gain WHERE userid=$userid"); print "You traded {$_POST['crystals']} crystals for \$".number_format($gain)."."; } } } $h->endpage(); ?> Also, it seems you have edited poorly... i don't see Karlos even as he is learning (as he says) making errors like this ;)
-
1.1 has no jail or hospital! how can i get a jail or hospital?
Lithium replied to LiQuiD's topic in General Discussion
Re: 1.1 has no jail or hospital! how can i get a jail or hospital? @crash2009 if you search around you will find them... also, picking a subject over two years old was not the best option ;) -
Re: help with a few bugs $db->query("UPDATE users SET cdays=cdays-1 WHERE course > 0"); Replace for $db->query("UPDATE users SET cdays=cdays-1 WHERE course > 0 AND cdays > 0"); this will stop negative days on courses. Organised crimes is not this cron but the solution might be pretty much similar.
-
Re: Auto quantify This only applies if V2
-
Re: [mccode v2] Looking for someone to secure if you wait a few more weeks he might do it for free as it was his price (just a couple weeks ago) i was talking about...
-
Re: [mccode v2] Looking for someone to secure At what work quality though? Prolly not the same where some people ask for $250+ for, trying to look pretenciously good...
-
Re: Hacked :( well, most of the users around are on a hurry to publish a game, then come here bitching the game was "hacked", if you hurry, well... deal with consequences... IF you do not have the knowledge to fix yourself... hire someone! if you don't have the cash to hire someone and you can't handle it yourself... my opinion... simply FORGET IT, or as i already said... deal with consequences... and please don't bitch if you get your game exploited for your own fault. @strats - this is not lead to you persobnally :P, but a personal opinion on the average "game owner"
-
Re: MySQL Procedures hmmm newest newest might be 6.summin :P i'm using 5.1.1? and your routine also errors meaning i might be missing something as well
-
Re: MySQL Procedures lol, i figured that, thought the .summin is important as if i can recall those are available only around 5.1.??
-
Re: MySQL Procedures what version are you using on mysql?
-
[any version] Removal of 1 minute crons
Lithium replied to Haunted Dawg's topic in Free Modifications
Re: [any version] Removal of 1 minute crons timestamped actions can be an option, yet it will increase the load more than crons, unless you close open connections, even though the load is higher than crons. One other option... are the mysql events :P While this is true - not all servers have MySQL 6.* yet. The developers of MySQL strongly recommend that you do not use MySQL 6.* until there is a stable release. @MTG - just a small correction... events were introduced in 5.1, working with minor glitches (or none if you can do some workarounds), as of version 6, i'm a bit away of current status yet i can pretty much figure as you say... it will come with the glitches fixed up and a lot of new goodies ;) -
Re: chmod public_html to 777 http://www.pageresource.com/cgirec/chmod.htm then you will get how dangerous it is ;)
-
Make people get item for every time online??
Lithium replied to RazorBladerz's topic in General Discussion
Re: Make people get item for every time online?? Best way is Dayo's one... And unix time is measured in seconds so... 1 minute = 60 seconds; 1 hour = 60 minutes then 1 hour = 60*60 = 3600... so you are right on there as well -
Re: I am a bit confused minor correction ;) mysql_query is a native php function
-
Re: Questions about languages. 1- 37 2 - Portugal 3 - Portuguese, Spanish, English, French, Italian, German 4 - (same order as above) Native language, Self taught (similar to portuguese), School, School, Self taught, Self taught.
-
Re: a couple of mods NPC = Non Playing Character... Though if you want them to attack... add a cron to randomly attack users
-
userlist.php (correctly) shows huge number of pages
Lithium replied to Lowball's topic in General Discussion
Re: userlist.php (correctly) shows huge number of pages Quite wrong, assuming people that ask for help can think (and can code) what you can and SHOULD do is to point them in the right direction. Giving the answer is NOT a way to help. Besides that, my 2nd post on this thread, gives an answer that can be worked to suit the needs according my first post. ;) -
Re: Fast & Furious boring! and the way it ends gives the idea of a continuation! they should have stick with only the first one!