corruptcity || skalman Posted February 22, 2010 Posted February 22, 2010 hi ive made the cron for my drugs mod but it doesnt seem to be doing what i want it todo if you could point me in the right direction if its wrong id be most gratful <?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']; } #used to produce the drugs $q=$db->query("SELECT grow,druglab FROM drugs"); while($r=$db->fetch_row($q)) { $lab = $r['druglab']; $amnt = 10; $gained = ($lab * $amnt); $inv=$db->query(sprintf("SELECT * FROM drugs_inv WHERE dinv_userid = %d AND (dinv_drugid = %d)", $ir['userid'], $r['grow'])); if($db->num_rows($inv) == 0) { $db->query("INSERT INTO drugs_inv (dinv_id, dinv_userid, dinv_drugis, dinv_qty) VALUES ('', $ir['userid'], $r['grow'], {$gained})"); } else { $db->query("UPDATE drugs_inv SET dinv_qty = dinv_qty + {$gained} WHERE dinv_drugid = {$r['grow=']}"); } } #This is for the streets $drug=$db->query("SELECT drug_id FROM drugs_drugs"); $d=$db->fetch_row($drug); $price=$db->query(sprintf("SELECT buy,stock_price FROM drugs_streets WHERE (drug_id = %d)", $d['drug_id'])); $b=$db->fetch_row($price); if($b['buy'] <= 0) { $db->query(sprintf("UPDATE drugs_streets SET buy = %d WHERE (drug_id = %d)", $b['stock_price'], $d['drug_id'])); } else { $buy = $db->query("SELECT drug_id FROM `drugs_drugs`"); while($price = $db->fetch_row($buy)) { $rand = mt_rand(1,2); if($rand == 2) { $mr = mt_rand(1,50); $db->query(sprintf("UPDATE drugs_streets SET buy = buy + %d WHERE (drug_id = %d)", $mr, $price['drug_id'])); } else { $mr = mt_rand(50,100); $db->query(sprintf("UPDATE drugs_streets SET buy = buy + %d WHERE (drug_id = %d)", $mr, $price['drug_id'])); } } } ?> Quote
Jordan Palmer Posted February 22, 2010 Posted February 22, 2010 What you want it to do? Hit me up on MSN, I'll do it :) Quote
Jordan Palmer Posted February 22, 2010 Posted February 22, 2010 [align=center]Cron fixed :) [/align] 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.