thebobby Posted December 17, 2010 Share Posted December 17, 2010 <? include 'dbcon.php'; include 'classes.php'; $randN = rand(1,25); $ng = mysql_query("SELECT * FROM numbergame WHERE number = {$randN} LIMIT 1") or mysql_error(); $g = mysql_fetch_array($ng); Send_Event($g['userid'],"<font color=green>Congratulations, You have won 25 points in the number game!</font>"); mysql_query("UPDATE `grpgusers` SET `points` = `points` + 25 WHERE `id` = '{$g['userid']}' LIMIT 1") or mysql_error(); mysql_query("UPDATE `numbergame` SET `userid` = 0") or mysql_error(); // kill of the hour $kf = mysql_query("SELECT * FROM `grpgusers` ORDER BY `hkills` DESC LIMIT 1") or mysql_error(); $kh = mysql_fetch_array($kf); $kill_class = new User($kh['id']); $amountofkills = $kh['hkills']; $killsid = $kh['id']; $reskill = "0"; Send_Event($killsid,"<font color=orange>Congratulations, You are the mobster of the hour and won 100 points!</font>"); mysql_query("UPDATE `grpgusers` SET `points` = `points` + 100, `hkills` = '$reskill' WHERE `id` = '{$kh['id']}' LIMIT 1") or mysql_error(); $inskills= mysql_query("INSERT INTO `hourfame` (`who`, `kills`)". "VALUES ('$killsid', '$amountofkills')") or mysql_error(); $resetthekills= mysql_query("UPDATE `grpgusers` SET `hkills` = 0") or mysql_error(); //other stuff $result = mysql_query("SELECT * FROM `grpgusers`"); $line = mysql_fetch_array($result, MYSQL_ASSOC); $updates_user = new User($line['id']); $result3 = mysql_query("SELECT*FROM `gangs` WHERE `crimetime` > '0'"); $worked3 = mysql_fetch_array($result3); $updates_gang = new Gang($worked3['id']); $newfreezehrs = $updates_user->freezehrs - 1; $newfreezehrs = ($newfreezehrs < 0) ? 0 : $newfreezehrs; $newmailbanhrs = $updates_user->mailbanhrs - 1; $newmailbanhrs = ($newmailbanhrs < 0) ? 0 : $newmailbanhrs; $newforumbanhrs = $updates_user->forumbanhrs - 1; $newforumbanhrs = ($newforumbanhrs < 0) ? 0 : $newforumbanhrs; $newgangcrime = $updates_gang->time - 1; $result = mysql_query("UPDATE `grpgusers` SET `sbbanhrs`='".$newsbbanhrs."', `forumbanhrs`='".$newforumbanhrs."', `mailbanhrs`='".$newmailbanhrs."', `freezehrs`='".$newfreezehrs."' WHERE `id`='".$updates_user->id."'"); $result = mysql_query("UPDATE `gangs` SET `crimetime`='".$newgangcrime."' WHERE `crimetime`!='0'"); ?> Quote Link to comment Share on other sites More sharing options...
Jordan Palmer Posted December 17, 2010 Share Posted December 17, 2010 Have you set it up using crontab? Quote Link to comment Share on other sites More sharing options...
thebobby Posted December 17, 2010 Author Share Posted December 17, 2010 like this curl http://mysite.com/Hour_cRON_CHhourlycrontorunaaaAAddDDW8N.php Quote Link to comment Share on other sites More sharing options...
corruptcity || skalman Posted December 17, 2010 Share Posted December 17, 2010 did you add ?code=whatever it is in config.php aswell? so it wud be like http://mysite.com/cron_day.php?code=yourcodehere ignore this i thought this was for mccrap not GRPG lol Quote Link to comment Share on other sites More sharing options...
thebobby Posted December 17, 2010 Author Share Posted December 17, 2010 ok so dont do that Quote Link to comment Share on other sites More sharing options...
corruptcity || skalman Posted December 17, 2010 Share Posted December 17, 2010 idk ive never used GRPG b4 m8 Quote Link to comment Share on other sites More sharing options...
Kieran-R Posted December 17, 2010 Share Posted December 17, 2010 run the file manually by typing the URL into your browser, then tell us the error. Quote Link to comment Share on other sites More sharing options...
thebobby Posted December 17, 2010 Author Share Posted December 17, 2010 1 error but it works when i mannually do Warning: Division by zero in /home/mafiasfi/public_html/classes.php on line 512 this is classes file 508 through 518 508 $this->vault = $worked['vault']; 510 $this->desc = $worked['desc']; 512 $this->gexppercent = floor(($this->exp / $this->maxexp2) * 100); 514 $this->formattedexp = $this->exp." / ".$this->maxexp2." [".$this->gexppercent."%]"; 516 $this->extdesc = $worked['extdesc']; 518 $this->points = $worked['points']; Quote Link to comment Share on other sites More sharing options...
Kieran-R Posted December 17, 2010 Share Posted December 17, 2010 Check that $worked['vault']; does not = 0, or no number at all. If so, theres your problem. Quote Link to comment Share on other sites More sharing options...
thebobby Posted December 17, 2010 Author Share Posted December 17, 2010 part of the code $this->exp = $worked['exp']; $this->level = $worked['level']; $this->maxexp2 = $this->level*1500; $this->vault = $worked['vault']; $this->desc = $worked['desc']; $this->gexppercent = floor(($this->exp / $this->maxexp2) * 100); $this->formattedexp = $this->exp." / ".$this->maxexp2." [".$this->gexppercent."%]"; $this->extdesc = $worked['extdesc']; $this->points = $worked['points']; $gangcheck = mysql_query("SELECT * FROM `grpgusers` WHERE `gang`='".$line['id']."'"); $members = mysql_num_rows($gangcheck); $this->crime = $worked['crimeid']; $this->time = $worked['crimetime']; $this->maxpvault = $worked['mxvaultpts']; $this->vmultiplier = $worked['vaultmultiplier']; $this->pmax = prettynum(250+($this->maxpvault * 100)); $this->vmax = prettynum(25000000+($this->vmultiplier * 5000000)); if ($this->exp >= $this->maxexp2){ $newglvl = $this->level + 1; $result2 = mysql_query("UPDATE `gangs` SET `level`='".$newglvl."' WHERE `id`='".$this->id."'"); $result2 = mysql_query("UPDATE `gangs` SET `exp`='0' WHERE `id`='".$this->id."'"); } if($this->crime != 0 && $this->time == 0){ $resulta = mysql_query("SELECT*FROM `gangcrimes` WHERE `id`='".$this->crime."' ORDER BY `exp`"); $workeda = mysql_fetch_array($resulta); $status = rand(0, 3); if($status == 1){ $gnewmoney = $this->vault + $workeda['money']; $gnewexp = $this->exp + $workeda['exp']; $result = mysql_query("UPDATE `gangs` SET `vault`='".$gnewmoney."', `exp`='".$gnewexp."' WHERE `id`='".$this->id."'"); $result = mysql_query("INSERT INTO `gangcrimelog` (`gangid`, `crime`, `passorfail`)"."VALUES ('".$this->id."', '".$workeda['id']."', '1')"); $result = mysql_query("UPDATE `gangs` SET `crimeid`='0' WHERE `id`='".$this->id."'"); } if($status == "2"){ $result = mysql_query("INSERT INTO `gangcrimelog` (`gangid`, `crime`, `passorfail`)"."VALUES ('".$this->id."', '".$workeda['id']."', '0')"); $result = mysql_query("UPDATE `gangs` SET `crimeid`='0' WHERE `id`='".$this->id."'"); } } 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.