Jump to content
MakeWebGames

How the hell does this work?


? Sparks ?

Recommended Posts

Fatal error: Cannot redeclare item_remove() (previously declared in /home/unitedmo/public_html/skate-or-die/itemmarket.php:63) in /home/unitedmo/public_html/skate-or-die/global_func.php on line 323

 

I was making a mod and It said that, I went back to the original files and It still says that

Link to comment
Share on other sites

Re: How the hell does this work?

 

Fatal error: Cannot redeclare item_remove() (previously declared in /home/unitedmo/public_html/skate-or-die/itemmarket.php:63) in /home/unitedmo/public_html/skate-or-die/global_func.php on line 323

 

I was making a mod and It said that, I went back to the original files and It still says that

I've already posted on rastus' topic about it after your thread - go see it.

Link to comment
Share on other sites

Re: How the hell does this work?

 

<?php
include "globals.php";
$_GET['ID'] = abs((int) $_GET['ID']);
$_GET['qty'] = abs((int) $_GET['qty']);
//itemsend
if($_GET['qty'])
{
$id=$db->query("SELECT iv.*,it.* FROM inventory iv LEFT JOIN items it ON iv.inv_itemid=it.itmid WHERE iv.inv_id={$_GET['ID']} AND iv.inv_userid=$userid LIMIT 1");
if($db->num_rows($id)==0)
{
print "Invalid item ID";
}
else
{
$r=$db->fetch_row($id);
if($_GET['qty'] > $r['inv_qty'])
{
print "You are trying to send more than you have!";
}
else
{
$price=$r['itemsellprice']*$_GET['qty'];
//are we sending it all
item_remove($userid, $r['itmid'], $_GET['qty']);
$db->query("UPDATE users SET money=money+{$price} WHERE userid=$userid");
$priceh="$".($price);
print "You sold {$_GET['qty']} {$r['itmname']}(s) for {$priceh}";
$db->query("INSERT INTO itemselllogs VALUES ('', $userid, {$r['itmid']}, $price, {$_GET['qty']}, unix_timestamp(), '{$ir['username']} sold {$_GET['qty']} {$r['itmname']}(s) for {$priceh}')");
}
}
}
else if($_GET['ID'])
{
$id=$db->query("SELECT iv.*,it.* FROM inventory iv LEFT JOIN items it ON iv.inv_itemid=it.itmid WHERE iv.inv_id={$_GET['ID']} and iv.inv_userid=$userid LIMIT 1");
if($db->num_rows($id)==0)
{
print "Invalid item ID";
}
else
{
$r=$db->fetch_row($id);
print "[b]Enter how many {$r['itmname']} you want to sell. You have {$r['inv_qty']} to sell.[/b]

<form action='itemsell.php' method='get'>
<input type='hidden' name='ID' value='{$_GET['ID']}' />
Quantity: <input type='text' name='qty' value='' />

<input type='submit' value='Sell Items (no prompt so be sure!' /></form>";
}
}
else
{
print "Invalid use of file.";
}
$h->endpage();
?>

 

Fatal error: Call to undefined function: item_remove() in /home/unitedmo/public_html/skate-or-die/itemsell.php on line 24

 

Can someone fix this for me?

Link to comment
Share on other sites

Re: How the hell does this work?

To make this as simple as possible, let me explain it.

Declare means the funtion has already been written in anohter part of your application, or in this case game.

So if you actually read the error message, you will see "Cannot redeclare", it should be simple to understand.

You cannot make two functions with the same name in PHP, it's just not allowed.

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