Jump to content
MakeWebGames

Recommended Posts

Posted

Hello everyone :-D

I have a problem with my minute.php cron. Below is my cron named minute.php:

 

<?php

require "mysql.php";

require "global_func.php";

include "arson.config.php";

global $c,$db_config;

////////////////////////////////////

//auction code

////////////////////////////////////

mysql_query("update auctions set time=time-1",$c);

$qqq=mysql_query("select * from auctions where time=0",$c);

while($win=mysql_fetch_array($qqq))

{

$time=$win['time'];

$item=$win['itemname'];

$winner=$win['bidder'];

$current=$win['current'];

$owner=$win['owner'];

$iname=mysql_result(mysql_query("SELECT itmname FROM items WHERE itmid={$item}", $c), 0, 0);

if($win['bids']>0)

{

mysql_query("insert into inventory VALUES('',$item,$winner,1)",$c) or die(mysql_error());

mysql_query("UPDATE users SET money=money+{$win['current']} WHERE userid=$owner",$c);

event_add($winner,"You won the auction of the {$iname} for \${$win['current']}",$c);

event_add($owner, "Your {$iname} sold succesfully on the auction market with {$win['bids']} bids. You have been paid \${$win['current']}", $c);

}

if($win['bids']==0)

{

event_add($win['owner'],"Your auction has ended with no bidders. Your {$iname} has been returned to your inventory.",$c);

$winner=$win['owner'];

mysql_query("insert into inventory VALUES('',$item,$winner,1)",$c) or die(mysql_error());

}

}

mysql_query("delete from auctions where time=0", $c);

////////////////////////////////////

//end of auction code

////////////////////////////////////

////////////////////////////////////

//misc minute counters

////////////////////////////////////

mysql_query("UPDATE userpets SET phospital=phospital-1 WHERE phospital>0",$c);

mysql_query("UPDATE userpets SET phospital=phospital 0 WHERE phospital<0",$c);

mysql_query("UPDATE userpets SET pound=pound-1 WHERE pound>0",$c);

mysql_query("UPDATE userpets SET pound=0 WHERE pound <= 0",$c);

mysql_query("UPDATE userpets SET poundreason='' WHERE pound <= 0",$c);

mysql_query("UPDATE userpets SET phospreason='' WHERE phospital <= 0",$c);

mysql_query("UPDATE users set hosptime=hosptime-1 WHERE hosptime>0",$c);

mysql_query("UPDATE users set jailtime=jailtime-1 WHERE jailtime>0",$c);

mysql_query("UPDATE users SET validation=validation-1 WHERE validation > 0",$c);

////////////////////////////////////

//misc minute counters

////////////////////////////////////

//arson countdown

mysql_query("UPDATE users SET arsontime=arsontime-1 where arson>0",$c);

mysql_query("UPDATE users SET maxwill=arson where arsontime=0 AND arson>0",$c);

mysql_query("UPDATE users SET will=arson where arsontime=0 AND arson>0",$c);

mysql_query("UPDATE users SET arson=0 where arsontime=0 AND arson>0",$c);

mysql_query("UPDATE users SET arsontime={$db_config['AT2']} where arsontime>{$db_config['AT2']} AND insurance>0",$c);

mysql_query("UPDATE users SET arsontime=0 where arson=0 AND arsontime>0",$c);

/////////////////////////

?>

And here is the email i recieve:

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/murderco/crons/minute.php on line 12

Thankyou for taking the time to read this and any advice/help would be great.

Thanks

Ben

Posted

Re: Cron advise

as of... you say that you are having issues with auctions... prolly they are going to negative as well...

This

mysql_query("update auctions set time=time-1",$c);

should be set as

mysql_query("update auctions set time=time-1 WHERE time > 0",$c);

after that, just place a dummy auction let it go to 0 and test it again

Posted

Re: Cron advise

Thankyou very much for that!

My main problem is that the cron wont run due to the error message.

So my hospital time, jail time etc arent decreasing due o the cron not running.

Any help on why im getting that error would be great

Thanks

Posted

Re: Cron advise

 

mysql_query("UPDATE userpets SET phospital=phospital-1 WHERE phospital>0",$c);
mysql_query("UPDATE userpets SET phospital=phospital 0 WHERE phospital<0",$c);
mysql_query("UPDATE userpets SET pound=pound-1 WHERE pound>0",$c);
mysql_query("UPDATE userpets SET pound=0 WHERE pound <= 0",$c);
mysql_query("UPDATE userpets SET poundreason='' WHERE pound <= 0",$c);
mysql_query("UPDATE userpets SET phospreason='' WHERE phospital <= 0",$c);
mysql_query("UPDATE users set hosptime=hosptime-1 WHERE hosptime>0",$c);
mysql_query("UPDATE users set jailtime=jailtime-1 WHERE jailtime>0",$c);
mysql_query("UPDATE users SET validation=validation-1 WHERE validation > 0",$c);
////////////////////////////////////
//misc minute counters
////////////////////////////////////

//arson countdown
mysql_query("UPDATE users SET arsontime=arsontime-1 where arson>0",$c);
mysql_query("UPDATE users SET maxwill=arson where arsontime=0 AND arson>0",$c);
mysql_query("UPDATE users SET will=arson where arsontime=0 AND arson>0",$c);
mysql_query("UPDATE users SET arson=0 where arsontime=0 AND arson>0",$c);
mysql_query("UPDATE users SET arsontime={$db_config['AT2']} where arsontime>{$db_config['AT2']} AND insurance>0",$c);
mysql_query("UPDATE users SET arsontime=0 where arson=0 AND arsontime>0",$c);

Dang so many queries

Posted

Re: Cron advise

not sure if this will work but try

 

<?php
require "mysql.php";
require "global_func.php";
include "arson.config.php";
global $c,$db_config;

////////////////////////////////////
//auction code
////////////////////////////////////
mysql_query("update auctions set time=time-1",$c);
$qqq=mysql_query("select * from auctions where time=0",$c);
if (mysql_num_rows($qqq))
{
while($win=mysql_fetch_array($qqq))
{

$time=$win['time'];
$item=$win['itemname'];
$winner=$win['bidder'];
$current=$win['current'];
$owner=$win['owner'];

$iname=mysql_result(mysql_query("SELECT itmname FROM items WHERE itmid={$item}", $c), 0, 0);
if($win['bids']>0)
{
mysql_query("insert into inventory VALUES('',$item,$winner,1)",$c) or die(mysql_error());
mysql_query("UPDATE users SET money=money+{$win['current']} WHERE userid=$owner",$c);
event_add($winner,"You won the auction of the {$iname} for \${$win['current']}",$c);
event_add($owner, "Your {$iname} sold succesfully on the auction market with {$win['bids']} bids. You have been paid \${$win['current']}", $c);
}
if($win['bids']==0)
{
event_add($win['owner'],"Your auction has ended with no bidders. Your {$iname} has been returned to your inventory.",$c);

$winner=$win['owner'];

mysql_query("insert into inventory VALUES('',$item,$winner,1)",$c) or die(mysql_error());
}
}
}
mysql_query("delete from auctions where time=0", $c);
////////////////////////////////////
//end of auction code
////////////////////////////////////

////////////////////////////////////
//misc minute counters
////////////////////////////////////
mysql_query("UPDATE userpets SET phospital=phospital-1 WHERE phospital>0",$c);
mysql_query("UPDATE userpets SET phospital=phospital 0 WHERE phospital<0",$c);
mysql_query("UPDATE userpets SET pound=pound-1 WHERE pound>0",$c);
mysql_query("UPDATE userpets SET pound=0 WHERE pound <= 0",$c);
mysql_query("UPDATE userpets SET poundreason='' WHERE pound <= 0",$c);
mysql_query("UPDATE userpets SET phospreason='' WHERE phospital <= 0",$c);
mysql_query("UPDATE users set hosptime=hosptime-1 WHERE hosptime>0",$c);
mysql_query("UPDATE users set jailtime=jailtime-1 WHERE jailtime>0",$c);
mysql_query("UPDATE users SET validation=validation-1 WHERE validation > 0",$c);
////////////////////////////////////
//misc minute counters
////////////////////////////////////

//arson countdown
mysql_query("UPDATE users SET arsontime=arsontime-1 where arson>0",$c);
mysql_query("UPDATE users SET maxwill=arson where arsontime=0 AND arson>0",$c);
mysql_query("UPDATE users SET will=arson where arsontime=0 AND arson>0",$c);
mysql_query("UPDATE users SET arson=0 where arsontime=0 AND arson>0",$c);
mysql_query("UPDATE users SET arsontime={$db_config['AT2']} where arsontime>{$db_config['AT2']} AND insurance>0",$c);
mysql_query("UPDATE users SET arsontime=0 where arson=0 AND arsontime>0",$c);
/////////////////////////

?>

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...