kjehun Posted January 14, 2009 Posted January 14, 2009 I need help with cron, and i want to use timestamp instead. i have only one problem, i have no idea how. I have made a site, and I've got it online, but i cant deal with the crons. can some of you make a full timestamp mod? Please? :| :mrgreen: Quote
John99 Posted January 14, 2009 Posted January 14, 2009 Re: [mccodes v2] Awsome cron help [TIMESTAMP] Yo.......... You posted in the rong baord!!!! Quote
Dazza Posted January 14, 2009 Posted January 14, 2009 Re: [mccodes v2] Awsome cron help [TIMESTAMP] Explain abit more Quote
John99 Posted January 14, 2009 Posted January 14, 2009 Re: [mccodes v2] Awsome cron help [TIMESTAMP] Yo like i said rong board too most needs to be moved xD :) Quote
Dazza Posted January 14, 2009 Posted January 14, 2009 Re: [mccodes v2] Awsome cron help [TIMESTAMP] Yo like i said rong board too most needs to be moved xD :) Yeah I read the first time and yes it is in the wrong place but I bet it'll get moved - I didnt want to wait so asked my question to him now Quote
John99 Posted January 14, 2009 Posted January 14, 2009 Re: [mccodes v2] Awsome cron help [TIMESTAMP] Yeah.. i knoww.... lol Quote
Eternal Posted January 15, 2009 Posted January 15, 2009 Re: [mccodes v2] Awsome cron help [TIMESTAMP] What exactly are you wanting help with on the crons mate? Quote
Delete-please Posted January 15, 2009 Posted January 15, 2009 Re: [mccodes v2] Awsome cron help [TIMESTAMP] I think he wants rid of his crons and wants time stamps instead Quote
POG1 Posted January 15, 2009 Posted January 15, 2009 Re: [mccodes v2] Awsome cron help [TIMESTAMP] This is only a guide ( i created this for a non mccodes game ;) ).. <?php $result = $DB->query("SELECT * FROM `updates` WHERE `name` = '5min'"); $result = $DB->fetchRow($result); $howLongAgo = time() - $result['last']; if($howLongAgo > (300)) { $n = floor($howLongAgo / 300); $user = new User($_SESSION['userid']); $energy = ($user->energy) + (5 * $n); $energy = ($energy > $user->maxenergy) ? $user->maxenergy : $energy; $brave = ($user->brave) + (2 * $n); $brave = ($brave > $user->brave) ? $user->maxbrave : $brave; $hp = $user->hp + (($user->maxhp * .25) * $n); $hp = ($hp > $user->maxhp) ? $user->maxhp : $newhp; $will = ($user->will) + (5 * $n); $will = ($will > $user->will) ? $user->maxwill : $will; $string = sprintf("UPDATE `users` SET `energy` = '%u', `brave` = '%u', `hp` = '%u', `will` = '%u'", abs(@intval($energy)),abs(@intval($brave)),abs(@intval($hp,$will))); $DB->query($string); $t = time(); $result = $DB->query("UPDATE `updates` SET `last` = '%u' WHERE `name` = '5min'",$t); $l = $t - (floor($t / 300) * 300); if ($l > 0) { $newUpdate = time() - $l; $result = $DB->query(sprintf("UPDATE `updates` SET `last` = '%u' WHERE `name` = '5min'",$newUpdate)); } } ?> Quote
Delete-please Posted January 15, 2009 Posted January 15, 2009 Re: [mccodes v2] Awsome cron help [TIMESTAMP] Nice :lol: Time stamps are very useful :wink: Quote
kjehun Posted January 18, 2009 Author Posted January 18, 2009 Re: [mccodes v2] Awsome cron help [TIMESTAMP] I am looking for someone that can help me, or make a timestamp instead of cron. Cron is impossible to get to work free... + My crons are not working, the link does not work... Quote
kjehun Posted January 18, 2009 Author Posted January 18, 2009 Re: [mccodes v2] Awsome cron help [TIMESTAMP] This is only a guide ( i created this for a non mccodes game ;) ).. <?php $result = $DB->query("SELECT * FROM `updates` WHERE `name` = '5min'"); $result = $DB->fetchRow($result); $howLongAgo = time() - $result['last']; if($howLongAgo > (300)) { $n = floor($howLongAgo / 300); $user = new User($_SESSION['userid']); $energy = ($user->energy) + (5 * $n); $energy = ($energy > $user->maxenergy) ? $user->maxenergy : $energy; $brave = ($user->brave) + (2 * $n); $brave = ($brave > $user->brave) ? $user->maxbrave : $brave; $hp = $user->hp + (($user->maxhp * .25) * $n); $hp = ($hp > $user->maxhp) ? $user->maxhp : $newhp; $will = ($user->will) + (5 * $n); $will = ($will > $user->will) ? $user->maxwill : $will; $string = sprintf("UPDATE `users` SET `energy` = '%u', `brave` = '%u', `hp` = '%u', `will` = '%u'", abs(@intval($energy)),abs(@intval($brave)),abs(@intval($hp,$will))); $DB->query($string); $t = time(); $result = $DB->query("UPDATE `updates` SET `last` = '%u' WHERE `name` = '5min'",$t); $l = $t - (floor($t / 300) * 300); if ($l > 0) { $newUpdate = time() - $l; $result = $DB->query(sprintf("UPDATE `updates` SET `last` = '%u' WHERE `name` = '5min'",$newUpdate)); } } ?> How can i use this instead of cron? :D Write something in my index or login or..? ;) Sorry, but im a n00b in this. Trying to learn Quote
GodLovesEcstasy Posted December 31, 2009 Posted December 31, 2009 This is only a guide ( i created this for a non mccodes game ;) ).. $result = $DB->query("SELECT * FROM `updates` WHERE `name` = '5min'"); $result = $DB->fetchRow($result); $howLongAgo = time() - $result['last']; if($howLongAgo > (300)) { $n = floor($howLongAgo / 300); $user = new User($_SESSION['userid']); $energy = ($user->energy) + (5 * $n); $energy = ($energy > $user->maxenergy) ? $user->maxenergy : $energy; $brave = ($user->brave) + (2 * $n); $brave = ($brave > $user->brave) ? $user->maxbrave : $brave; $hp = $user->hp + (($user->maxhp * .25) * $n); $hp = ($hp > $user->maxhp) ? $user->maxhp : $newhp; $will = ($user->will) + (5 * $n); $will = ($will > $user->will) ? $user->maxwill : $will; $string = sprintf("UPDATE `users` SET `energy` = '%u', `brave` = '%u', `hp` = '%u', `will` = '%u'", abs(@intval($energy)),abs(@intval($brave)),abs(@intval($hp,$will))); $DB->query($string); $t = time(); $result = $DB->query("UPDATE `updates` SET `last` = '%u' WHERE `name` = '5min'",$t); $l = $t - (floor($t / 300) * 300); if ($l > 0) { $newUpdate = time() - $l; $result = $DB->query(sprintf("UPDATE `updates` SET `last` = '%u' WHERE `name` = '5min'",$newUpdate)); } } ?> I apologize for bumping ancient posts, but I'd like to know how I can use this instead of crons. Can anybody give me a little guidance? I'm trying to completely replace all my crons. Where would I put this code? Quote
Dominion Posted December 31, 2009 Posted December 31, 2009 crons [any version] Removal of 1 minute crons look down that post theres a full cron remove thing for v2 Quote
GodLovesEcstasy Posted January 1, 2010 Posted January 1, 2010 [any version] Removal of 1 minute crons look down that post theres a full cron remove thing for v2 I used that guide to the dot and nothing seems to be happening.. none of my players stats are getting refilled, jail time is stuck, and so is hospital time. :/ Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.