Jump to content
MakeWebGames

Recommended Posts

Posted

I know $10 isn't a lot but this will probably take someone who knows what they're doing 10 minutes.

I need help with Cronus's armory mod. He said I could show someone a few of the files so they can help. I need someone to make it so when someone equips an item and it's lent, it updates the users table saying their Primary, Secondary or Armor is lent. (I made the rows for primarylent, secondarylent and armorlent).

I'll also need it so when you unequip the item and it's said in your users table that it's lent, it will make it so the item is marked as lent again in the inventory table. I haven't modified my equip weapon, equip armor or unequip files so you could just change those and it will be compatible for me.

I think all you really need to know is what I just said, and, that in inventory there is a new row called inv_lent which is marked as 1 when an item is lent.

Help would be much appreciated. Thanks.

Posted

Re: Need a little help ($10)

A few people have messaged me about this but I haven't really gotten anywhere. I'm not sure if I'm allowed to post the whole thing but I'll remove it if I'm not. Here's what I have, and I'm sure it's very noob-ish.

 

<?php
include "globals.php";
$_GET['ID'] = abs((int) $_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";
$h->endpage();
exit;
}
else
{
$r=$db->fetch_row($id);
}
if(!$r['weapon'])
{
print "This item cannot be equipped to this slot.";
$h->endpage();
exit;
}
if($_GET['type'])
{
if(!in_array($_GET['type'], array("equip_primary", "equip_secondary")))
{
print "This slot ID is not valid.";
$h->endpage();
exit;
}
if($ir[$_GET['type']])
{
item_add($userid, $ir[$_GET['type']], 1);
}
if ($inv['inv_lent']>0)
{
item_remove($userid, $r['itmid'], 1);
$db->query("UPDATE users SET {$_GET['type']} = {$r['itmid']}, ({$_GET['type']}lent)=({$_GET['type']}lent)+1 WHERE userid={$userid}");
print "Item {$r['itmname']} equipped successfully.";
}
else
item_remove($userid, $r['itmid'], 1);
$db->query("UPDATE users SET {$_GET['type']} = {$r['itmid']} WHERE userid={$userid}");
print "Item {$r['itmname']} equipped successfully.";
}
else
{
print "<h3>Equip Weapon</h3><hr />
<form action='equip_weapon.php' method='get'>
<input type='hidden' name='ID' value='{$_GET['ID']}' />
Please choose the slot to equip {$r['itmname']} to, if there is already a weapon in that slot, it will be removed back to your inventory.

<input type='radio' name='type' value='equip_primary' checked='checked' /> Primary

<input type='radio' name='type' value='equip_secondary'  /> Secondary

<input type='submit' value='Equip Weapon' /></form>";
}
$h->endpage();
?>

 

If you look at the if inv_lent part, what I was trying to do there is make it check to see if it's shown in the inventory table that the item is lent, and if it is, it will update the users table to show it is.

I don't even know if this would work but I wrote ({$_GET['type']}lent) hoping it would get either if it was primary or secondary and if it was, it would update my users table row called either equip_primarylent or equip_secondarylent with a +1 showing they are using a lent item.

Could someone please take a look at that code and tell me what I'm doing wrong? I don't really get how things are pulled from the database like putting $ir, $r or $inv before something will show that's the table it should be pulling info from. And do I need to select that information so it knows what I'm talking about?

Agh I hate not knowing what I'm doing! Haha :mrgreen:

Posted

Re: Need a little help ($10)

Forget my last post, what I was trying to do wasn't what I should have been doing.. At all.

I'm raising my payment to $20 for someone to take the included V1 Equip & Unequip files from he Armory mod and convert them to V2 for me. For someone who knows what they're doing I'm sure $20 is worth your time.

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