Jump to content
MakeWebGames

House Tax


Jameoo

Recommended Posts

hi can some one fix this please so i only add the stuff i need so i can add it to cron day

 

<?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'];
}
//House Tax Update
$uq=$db->query("SELECT * FROM users");
$Row=0;
while($r=$db->fetch_row($uq))
{
$will = $r['maxwill'];
$hq=$db->query("SELECT * FROM houses WHERE hWILL='{$will}'");
if($db->num_rows($hq) == 0)
{ }
$r2=$db->fetch_row($hq);
if($r['money'] < $r2['hTAX'])
{ $money=$r['money'];
event_add($ir['userid'],"You failed to pay the tax, so you have lost the house.");
print "You gave {$_POST['qty']} of item ID {$_POST['item']} to user ID {$_POST['user']}";
} else {
$db->query("UPDATE users SET money=money-'{$r2['hTAX']}' WHERE userid='{$r['userid']}'");
}
$Rows++;
}
?>

 

Thanks

Link to comment
Share on other sites

Re: House Tax

what do u mean ?

u mean like this?

 

  //House Tax Update
 $uq = $db->query("SELECT * FROM users");
 $Row = 0;
 while ($r = $db->fetch_row($uq)) {
     $will = $r['maxwill'];
     $hq = $db->query("SELECT * FROM houses WHERE hWILL='{$will}'");
     if ($db->num_rows($hq) == 0) {
     }
     $r2 = $db->fetch_row($hq);
     if ($r['money'] < $r2['hTAX']) {
         $money = $r['money'];
         event_add($ir['userid'], "You failed to pay the tax, so you have lost the house.");
         print "You gave {$_POST['qty']} of item ID {$_POST['item']} to user ID {$_POST['user']}";
     } else {
         $db->query("UPDATE users SET money=money-'{$r2['hTAX']}' WHERE userid='{$r['userid']}'");
     }
     $Rows++;
 }
Link to comment
Share on other sites

Re: House Tax

I think you need to relook at this code..

you have all sorts of problems going on..

your event_add is using $ir['userid'] instead of $r['userid'] which the code suggests it should be. The event also implies they lose their house if they dont have enough money on hand, yet i dont see a query to set their will and maxwill back to 100.

Instead of asking everyone for every little minor peice of code that you need, you should really study the code that you have that is working and in place, as well study php. if you cant figure out a query to alter the user to a stock house, logically you could look to see how its done estate.php under sell house.

Link to comment
Share on other sites

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