Jump to content
MakeWebGames

Recommended Posts

Posted

For some strange reason, the last 2 users that signed up cannot use or equip anything at all (ID's 151 and 152), it says invalid item ID, but everyone under ID 150 can use items just fine, I don't know if the ID has anything to do with it, just so happened after 150 users. Ayn ideas?

Oh and it does show their items in the database along with everyone else, they just cant use them.

  • 2 weeks later...
Posted

I still cannot seem to fix this, I want to be able to use the auto-quantifier, but when i do new players cannot use items, this is the code that I am using, which I got from here somewhere:

 

$used=array();
$q=mysql_query("SELECT * FROM inventory WHERE inv_userid=$userid");
while ( $r=mysql_fetch_array($q) ) {
if ( ! in_array ( $r['inv_id'], $used ) )
{
$currdel=array();
$used[] =$r['inv_id'];
$currdel[]=$r['inv_id'];
$amount=$r['inv_qty'];
$q2=mysql_query("SELECT * FROM inventory WHERE inv_userid=$userid AND inv_itemid = {$r['inv_itemid']} AND inv_id != {$r['inv_id']}");
while ( $r2 = mysql_fetch_array($q2) ) {
$used[]=$r2['inv_id'];
$currdel[]=$r2['inv_id'];
$amount+=$r2['inv_qty'];
}
mysql_query("DELETE FROM inventory WHERE inv_id IN(".implode(",",$currdel).")");
mysql_query("INSERT INTO inventory VALUES('', {$r['inv_itemid']}, $userid, $amount)");
}
}
Posted

yes either way works, but still for some reason just the new players cant use items, its gives them an invalid ID error when trying use use or equip anything.

Posted (edited)

It could be that you never set those items to weapons when you made them, edit them and see if you marked them to be weapons.

Also it is not hard to use the built in quantifier in global_func.php item_add it's less coding then what you have posted.

Edited by lucky3809
Posted

Well, if no users could use or equip the items then yea maybe they weren't set correctly, but as I stated, only newer users couldn't use or equip them.

also that's what I did, I got rid on the auto-quantifier that was causing the issue and coded it using the item_add function. Much simpler and less hassle.

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