Jump to content

Help with cars mod


Recommended Posts

Hi, I am having problems with the tune.php page for the cars mod. I saw another thread on this forum and added the function below:


function power($num1, $num2)
return pow($num1, $num2);


which made a table come up showing all the parts of the car I can tune, but now I can't set the cost of the items that need tuning and I can't change how much I want them to tune.


In the screenshot it shows the cost and the amount to tune as '0', I need help changing that.

Can somebody help me please?


Link to comment
Share on other sites

I dont have session_start() in mine but here is my tune.php that I have

include_once "globals.php";
function power($num1, $num2)
return pow($num1, $num2);
print "<h3>Tuning Shop</h3><hr />
> <a href='garage.php'>Back To Garage</a><hr />";
if(!$_GET['id']) { print "Invalid Usage"; $h->endpage(); exit(); }
$q=$db->query("SELECT cp.*,ct.* FROM cars_playercars cp LEFT JOIN cars_types ct ON ct.carID=cp.cpcCAR WHERE cp.cpcID={$_GET['id']} AND cp.cpcPLAYER=$userid");
if($db->num_rows($q) == 0) { print "Invalid Car"; $h->endpage(); exit(); }
if($_GET['buy'] != "acc" && $_GET['buy'] != "han" && $_GET['buy'] != "spd" && $_GET['buy'] != "shd") { print "Abusers suck."; $h->endpage(); exit(); }
if($ir['money'] < $upgr_cost) { print "You don't have enough money to tune this stat."; $h->endpage(); exit(); }
$db->query("UPDATE users SET money=money-{$upgr_cost} WHERE userid=$userid", $c);
$db->query("UPDATE cars_playercars SET $stat=$stat+1 WHERE cpcID={$_GET['id']}");
print "Car tuned!<br />
> <a href='tune.php?id={$_GET['id']}'>Tune some more</a>";
foreach($cost as $k => $v)
print "Current Stats for your {$r['carNAME']}<br />
<table width='90%'><tr> <th>Stat</th> <th>Amount</th> <th>Cost To Tune</th> <th>Tune</th></tr>
<tr> <td>Acceleration</td> <td>Lv{$r['cpcACCLV']} ($acc)</td> <td>{$costf['acc']}</td> <td><a href='tune.php?id={$_GET['id']}&buy=acc'>Tune</a></td></tr>
<tr><td>Speed</td> <td>Lv{$r['cpcSPDLV']} ($spd)</td> <td>{$costf['spd']}</td> <td><a href='tune.php?id={$_GET['id']}&buy=spd'>Tune</a></td></tr>
<tr> <td>Handling</td> <td>Lv{$r['cpcHANLV']} ($han)</td> <td>{$costf['han']}</td> <td><a href='tune.php?id={$_GET['id']}&buy=han'>Tune</a></td></tr>
<tr> <td>Shield</td> <td>Lv{$r['cpcSHDLV']} ($shd)</td>  <td>{$costf['shd']}</td> <td><a href='tune.php?id={$_GET['id']}&buy=shd'>Tune</a></td></tr>
Link to comment
Share on other sites

  • 2 weeks later...

I'm guessing it is somewhere in here:


$q=mysql_query("SELECT * FROM cars_tracks ORDER BY rand() LIMIT 1", $c);

$notes="No-one won anything";
mysql_query("UPDATE users SET cars_challs_accpt=cars_challs_accpt+1 WHERE userid=$userid", $c);
if($stats_y > $stats_o)
mysql_query("UPDATE users SET money=money+$winnings, cars_races_income=cars_races_income+$bet,cars_races_won=cars_races_won+1 WHERE userid={$r['chCHD']}", $c);
mysql_query("UPDATE users SET cars_races_income=cars_races_income-$bet,cars_races_lost=cars_races_lost+1 WHERE userid={$r['chCHR']}", $c);
if($bet > 0)
$notes="{$r['challenged']} won \$$winnings"; 
if($r['chTYPE'] == "High-Stakes")
mysql_query("UPDATE cars_playercars SET cpcPLAYER=$userid WHERE cpcID={$r['cpcID']}", $c);
$notes="{$r['challenged']} won {$r['challenger']}\'s {$r['carNAME']}";
mysql_query("UPDATE users SET cars_lost=cars_lost+1 WHERE userid={$r['chCHR']}", $c);
mysql_query("UPDATE users SET cars_won=cars_won+1,cars_owned=cars_owned+1 WHERE userid={$r['chCHD']}", $c);
else if($r['chTYPE'] == "Betted")
mysql_query("UPDATE users SET cars_races_betted=cars_races_betted+1 WHERE userid IN ({$r['chCHR']}, {$r['chCHD']})", $c);
mysql_query("UPDATE users SET cars_races_friendly=cars_races_friendly+1 WHERE userid IN ({$r['chCHR']}, {$r['chCHD']})", $c);


also, after the first $winner=$ir['username'], I changed the $ir['username'] to $r['challenged'] but it didn't make a difference.

Edited by Ikz786
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.

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