Jump to content

requires


grlayouts

Recommended Posts

ok i have a game based on markets. the code i have takes the stock level and determains a price. what i want to try to get is if one requirment is not there then the payout does not happen.

 

ie. if <200 plastic (as its 200 plastic per toy) then no payout.

 

so if i have 10 ($stats[toyfactorys]) i would need 20000 plastic. if i dont have it only make however much plastic i have or none.

 

any idea's???

 

the code i have is

 

<?
include('config.php');
$q2 = mysql_fetch_row(mysql_query("SELECT SUM(drugs) FROM players;"));
function price ($q)
{
    if ($q > 1000000) return 25;
    return ceil($q * -275 / 1000000) + 300;
}

$qtys = $q2;
foreach ($qtys as $q) 
{
    echo "$q :" . price($q) . '<br>';
}  
mysql_query('UPDATE players SET drugs = drugs + (drugfact*20), dpayout = (drugfact*20);');
mysql_query('UPDATE players SET credits = credits - (employees*wages)');
$sql = "UPDATE price SET cost = $q where ITEM = 'drugs'";
mysql_query($sql) or
  die($sql . ' : ' . mysql_error());
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.