Jump to content
MakeWebGames

Recommended Posts

Posted
ALTER TABLE users ADD gymconfirm INT(11) DEFAULT 0;

 

I want this so, every hour, it goes to 1 instead of 0, but I'm having a lot of trouble with it not working for cron_hour.php.

So, how would I do it correctly?

Posted

Re: Cron help

umm...

See this is where i meant, people need to actually go to the w3schools website or other websites and learn basics.

You would do something as simple as

update users set gymconfirm = 1 where gymconfirm = 0

also since you are just using 1 or 0 you probably dont need it set to INT(11).

Posted

Re: Cron help

Yeah i agree, and yea.

ALTER TABLE `users` ADD `gymconfirm` TINYINT(1) NOT NULL DEFAULT 0;

Dont ask my why i put the php tags, was just for color. LOL ;D

Posted

Re: Cron help

 

umm...

See this is where i meant, people need to actually go to the w3schools website or other websites and learn basics.

You would do something as simple as

update users set gymconfirm = 1 where gymconfirm = 0

also since you are just using 1 or 0 you probably dont need it set to INT(11).

That's odd, I've been doing that exact code before I posted here, and it doesn't work. Here's the cron_hour.php if you are interested.

 

<?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");
$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");
}
$db->query("UPDATE crystalmarket SET cmDAYS = cmDAYS - 1 WHERE cmDAYS > 0");
if($r['cmDAYS'] == 0)
{
$q=$db->query("SELECT cm.*, u.* FROM crystalmarket cm LEFT JOIN users u ON u.userid=cm.cmADDER ORDER BY cmPRICE/cmQTY ASC");
while($r=$db->fetch_row($q))
{
$q=$db->query("SELECT * FROM crystalmarket WHERE cmID={$r['cmID']} AND cmADDER={$r['userid']}");

$r=$db->fetch_row($q);
$db->query("UPDATE users SET crystals=crystals+{$r['cmQTY']} WHERE userid={$r['cmADDER']}");
$db->query("DELETE FROM crystalmarket WHERE cmID={$r['cmID']}");
$db->query("UPDATE users SET gymconfirm = 1 where gymconfirm = 0");
}
}
?>
Posted

Re: Cron help

well looks like you have that line of code inside an if statement that is used to clear your crystal market. if that if statement is not true... then the while never runs, and the line of code never runs.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...