Jump to content
MakeWebGames

shops help


boots
 Share

Recommended Posts

add this SQL to database

alter table items add itmbuycprice int(11) not null default 0;
alter table itembuylogs add ibTOTALPRICEC int(11) not null default 0;

 

open this file up... staff_items.php... and find this in ( function new_item_form() ) section...

Item Price: <input type='text' name='itmbuyprice' /><br />

replace it with...

Item Price: (money) <input type='text' name='itmbuyprice' /><br />
Item Price: (crystals) <input type='text' name='itmbuycprice' /><br />

 

on same file find...

if(!isset($_POST['itmname']) || !isset($_POST['itmdesc']) || !isset($_POST['itmtype'])  || !isset($_POST['itmbuyprice']) || !isset($_POST['itmsellprice']))

replace with...

if(!isset($_POST['itmname']) || !isset($_POST['itmdesc']) || !isset($_POST['itmtype'])  || !isset($_POST['itmbuyprice']) || !isset($_POST['itmsellprice']) || !isset($_POST['itmbuycprice']))

 

on same file about 10 lines down... find...

$m=$db->query("INSERT INTO items VALUES('',{$_POST['itmtype']},'$itmname','$itmdesc',{$_POST['itmbuyprice']},{$_POST['itmsellprice']},$itmbuy, '{$_POST['effect1on']}', '$efx1', '{$_POST['effect2on']}', '$efx2', '{$_POST['effect3on']}', '$efx3', $weapon, $armor)");

replace it with...

$m=$db->query("INSERT INTO items VALUES('',{$_POST['itmtype']},'$itmname','$itmdesc',{$_POST['itmbuyprice']},{$_POST['itmsellprice']},$itmbuy, '{$_POST['effect1on']}', '$efx1', '{$_POST['effect2on']}', '$efx2', '{$_POST['effect3on']}', '$efx3', $weapon, $armor, {$_POST['itmbuycprice']})");

 

then open up the file... shops.php... and find...

print "Browsing items at <b>{$shopdata['shopNAME']}...</b><br />
<table cellspacing=1 class='table'><tr style='background: gray;'><th>Item</th><th>Description</th><th>Price</th><th>Sell Price</th><th>Buy</th></tr>";

replace it with...

print "Browsing items at <b>{$shopdata['shopNAME']}...</b><br />
<table cellspacing=1 class='table'><tr style='background: gray;'><th>Item</th><th>Description</th><th>Price (money)</th><th>Price (crystals)</th><th>Sell Price</th><th>Buy</th></tr>";

 

on same file find...

print "\n<tr><td>{$r['itmname']}</td><td>{$r['itmdesc']}</td><td>\${$r['itmbuyprice']}</td><td>\${$r['itmsellprice']}</td><td><form action='itembuy.php?ID={$r['itmid']}' method='post'>Qty: <input type='text' name='qty' value='1' /><input type='submit' value='Buy' /></form></td></tr>";

replace with...

print "\n<tr><td>{$r['itmname']}</td><td>{$r['itmdesc']}</td><td>\${$r['itmbuyprice']}</td><td>{$r['itmbuycprice']}</td><td>\${$r['itmsellprice']}</td><td><form action='itembuy.php?ID={$r['itmid']}' method='post'>Qty: <input type='text' name='qty' value='1' /><input type='submit' value='Buy' /></form></td></tr>";

 

then open up... itembuy.php... and find...

if($ir['money'] < $itemd['itmbuyprice']*$_POST['qty'])
{
print "You don't have enough money to buy this item!";
$h->endpage();
exit;
}

under it put this...

if($ir['crystals'] < $itemd['itmbuycprice']*$_POST['qty'])
{
print "You don't have enough crystals to buy this item!";
$h->endpage();
exit;
}

 

on same file find...

$price=($itemd['itmbuyprice']*$_POST['qty']);
item_add($userid, $_GET['ID'], $_POST['qty']);
$db->query("UPDATE users SET money=money-$price WHERE userid=$userid");
$db->query("INSERT INTO itembuylogs VALUES ('', $userid, {$_GET['ID']}, $price, {$_POST['qty']}, unix_timestamp(), '{$ir['username']} bought {$_POST['qty']} {$itemd['itmname']}(s) for {$price}')");
print "You bought {$_POST['qty']} {$itemd['itmname']}(s) for \$$price";

replace it with...

$price=($itemd['itmbuyprice']*$_POST['qty']);
$pricec=($itemd['itmbuycprice']*$_POST['qty']);
item_add($userid, $_GET['ID'], $_POST['qty']);
$db->query("UPDATE users SET money=money-$price, crystals=crystals-$pricec WHERE userid=$userid");
$db->query("INSERT INTO itembuylogs VALUES ('', $userid, {$_GET['ID']}, $price, {$_POST['qty']}, unix_timestamp(), '{$ir['username']} bought {$_POST['qty']} {$itemd['itmname']}(s) for ${$price} and {$pricec} crystals', $pricec)");
print "You bought {$_POST['qty']} {$itemd['itmname']}(s) for \$$price and $pricec crystals.";
Edited by Nicholas
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.

 Share

×
×
  • Create New...