chaoswar4u Posted May 16, 2007 Share Posted May 16, 2007 The bug is regarding the bit of code that is used for the organised crimes. When it comes to the end of the crime you seceed or fail thus the cron comes with this message when failing to add events. The error is - Call to undefined function event_add() on line 36 This is the code out the cron $db->query("UPDATE gangs SET gangCHOURS=gangCHOURS-1 WHERE gangCRIME>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 here 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 here to view the details.",$c); } } } Line 36 being this event_add($rm['userid'],"Your Gang's Organised Crime Succeeded. Go here to view the details.",$c); error also applies to event_add($rm['userid'],"Your Gang's Organised Crime Failed. Go here to view the details.",$c); Anyone out there no how to fix? Thx for any help in advance. Quote Link to comment Share on other sites More sharing options...
UCC Posted May 16, 2007 Share Posted May 16, 2007 Re: Problem regarding Hour_Cron IN Mccode V2 I'm unclear on the details, but most crons dont seem to access global_func in 2.0. There is likely a reason for that. *shrug* I haven't bothered to figure it out. Anyway, I usually copy the event_add function from global_func and add it to any cron I want to use it Quote Link to comment Share on other sites More sharing options...
hamster01 Posted May 16, 2007 Share Posted May 16, 2007 Re: Problem regarding Hour_Cron IN Mccode V2 hmm.. Isn't there 3 coulombs in mail tabe? Quote Link to comment Share on other sites More sharing options...
chaoswar4u Posted May 16, 2007 Author Share Posted May 16, 2007 Re: Problem regarding Hour_Cron IN Mccode V2 Well Done deathstar. Another un useful reply. I added that function UCC but then came up with another error for undefined function. Ill have a look into and post my findings otherwise if anyone has already got the fix for this then your help would be great. Quote Link to comment Share on other sites More sharing options...
hamster01 Posted May 16, 2007 Share Posted May 16, 2007 Re: Problem regarding Hour_Cron IN Mccode V2 FYI, eventadd function has a few queries. Thus if its incorrect in can trough out an error ;) Quote Link to comment Share on other sites More sharing options...
Silver Posted May 16, 2007 Share Posted May 16, 2007 Re: Problem regarding Hour_Cron IN Mccode V2 if you have your crons in a different directory to your global_func.php, you will either need to reference the global_func.php from your cron file or make a copy of global_func.php and add it to ur cron directory Quote Link to comment Share on other sites More sharing options...
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.