benlakaz Posted July 19, 2009 Posted July 19, 2009 Hi to all.. please help me with this cron_hour because after 24 hrs I dont see anything in my event about the gang organised crimes i do not know if it is successful or not and if something happened because i do not received any events.. is there something wrong with the code below? Thanks in advance.. <?php include "config.php"; global $_CONFIG; if($_GET['code'] != $_CONFIG['code']) { die(""); } define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; $db=new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c=$db->connection_id; $set=array(); $settq=$db->query("SELECT * FROM settings"); while($r=$db->fetch_row($settq)) { $set[$r['conf_name']]=$r['conf_value']; } $db->query("UPDATE gangs SET gangCHOURS=gangCHOURS-1 WHERE gangCRIME>0 AND gangCHOURS>0"); $q=$db->query("SELECT g.*,oc.* FROM gangs g LEFT JOIN orgcrimes oc ON g.gangCRIME=oc.ocID WHERE g.gangCRIME > 0 AND g.gangCHOURS = 0"); while($r=$db->fetch_row($q)) { $suc=rand(0,1); if($suc) { $log=$r['ocSTARTTEXT'].$r['ocSUCCTEXT']; $muny=(int) (rand($r['ocMINMONEY'],$r['ocMAXMONEY'])); $log=str_replace(array("{muny}","'"),array($muny,"''"),$log); $db->query("UPDATE gangs SET gangMONEY=gangMONEY+$muny,gangCRIME=0 WHERE gangID={$r['gangID']}"); $db->query("INSERT INTO oclogs VALUES ('',{$r['ocID']},{$r['gangID']}, '$log', 'success', $muny, '{$r['ocNAME']}', unix_timestamp())"); $i=$db->insert_id(); $qm=$db->query("SELECT * FROM users WHERE gang={$r['gangID']}"); while($rm=$db->fetch_row($qm)) { event_add($rm['userid'],"Your Gang's Organised Crime Succeeded. Go [url='oclog.php?ID=$i']here[/url] to view the details.",$c); } } else { $log=$r['ocSTARTTEXT'].$r['ocFAILTEXT']; $muny=0; $log=str_replace(array("{muny}","'"),array($muny,"''"),$log); $db->query("UPDATE gangs SET gangCRIME=0 WHERE gangID={$r['gangID']}"); $db->query("INSERT INTO oclogs VALUES ('',{$r['ocID']},{$r['gangID']}, '$log', 'failure', $muny, '{$r['ocNAME']}', unix_timestamp())"); $i=$db->insert_id(); $qm=$db->query("SELECT * FROM users WHERE gang={$r['gangID']}"); while($rm=$db->fetch_row($qm)) { event_add($rm['userid'],"Your Gang's Organised Crime Failed. Go [url='oclog.php?ID=$i']here[/url] to view the details.",$c); } } } if(date('G')==17) { $db->query("UPDATE users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN jobs j ON j.jID=u.job LEFT JOIN jobranks jr ON u.jobrank=jr.jrID SET u.money=u.money+jr.jrPAY, u.exp=u.exp+(jr.jrPAY/20) WHERE u.job > 0 AND u.jobrank > 0"); $db->query("UPDATE userstats us LEFT JOIN users u ON u.userid=us.userid LEFT JOIN jobs j ON j.jID=u.job LEFT JOIN jobranks jr ON u.jobrank=jr.jrID SET us.strength=(us.strength+1)+jr.jrSTRG-1,us.labour=(us.labour+1)+jr.jrLABOURG-1,us.IQ=(us.IQ+1)+jr.jrIQG-1 WHERE u.job > 0 AND u.jobrank > 0"); } if($set['validate_period'] == 60 && $set['validate_on']) { $db->query("UPDATE users SET verified=0"); } ?> Quote
BlueDevil23 Posted July 19, 2009 Posted July 19, 2009 Re: please help with this one thanks Your using the event_add() function. Where does the event_add() function reside? Is it included in your script? Quote
Danny696 Posted July 19, 2009 Posted July 19, 2009 Re: please help with this one thanks event_add() is in the global_func Quote
benlakaz Posted July 19, 2009 Author Posted July 19, 2009 Re: please help with this one thanks thanks danny you gave me idea on how to solve the problem.. now its working Quote
3XTR3M3 Posted July 19, 2009 Posted July 19, 2009 Re: please help with this one thanks good but like you should try to solve problems like this yourself bbefore posting helps you learn faster:) Quote
Danny696 Posted July 19, 2009 Posted July 19, 2009 Re: please help with this one thanks Huh What Was The Idea? Quote
Eruondo Posted July 21, 2009 Posted July 21, 2009 Re: please help with this one thanks Huh What Was The Idea? I guess it was include "global_functions.php" Quote
Danny696 Posted July 21, 2009 Posted July 21, 2009 Re: please help with this one thanks Ahh yes Just add include "global_func.php"; To The Top And Your Done Quote
Eruondo Posted July 21, 2009 Posted July 21, 2009 Re: please help with this one thanks thanks danny you gave me idea on how to solve the problem.. now its working I think he's done it already. We're way to slow. Quote
Danny696 Posted July 21, 2009 Posted July 21, 2009 Re: please help with this one thanks thanks danny you gave me idea on how to solve the problem.. now its working I think he's done it already. We're way to slow. Just Telling EveryOne Else How To Do It Quote
Eruondo Posted July 21, 2009 Posted July 21, 2009 Re: please help with this one thanks Ah. Sorry. 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.