Jump to content
MakeWebGames

Recommended Posts

Posted

Hello, tried half an hour and couldnt do it myself so guess i'll be paying 2 bucks to the first awsome guy that is going to post the solution along with many thanks.

Here's where i want the pics of equipped items to be displayed.

24mwb5s.jpg

Here's my inventory file:

 

<?php
include "globals.php";
for($il=0;$il<112;$il++)
{
$item=mysql_query("SELECT * FROM inventory WHERE inv_userid=$userid AND inv_itemid=$il AND inv_qty > 0",$c);  
$gotitem = mysql_num_rows($item);
if($gotitem == 0)
{
$h=2;
}
else
{
$z=0; 
$id = $il;
while ($i=mysql_fetch_array($item)) 
{ 
$z=$z+$i['inv_qty']; 
}
$db->query("DELETE FROM inventory WHERE inv_userid=$userid AND inv_itemid=$id",$c); 
$db->query("INSERT INTO inventory VALUES ('', '$id', '$userid', '$z')",$c); 
}
}
$q=$db->query("SELECT * FROM items WHERE itmid IN({$ir['equip_primary']}, {$ir['equip_secondary']}, {$ir['equip_armor']}, {$ir['equip_helmet']}, {$ir['equip_boots']}, {$ir['equip_amulet']}, {$ir['equip_bracelet']}, {$ir['equip_ring']}, {$ir['equip_special']})");
print "<h3><span style='text-decoration: none; font-size: 16px; font-weight: 600'>Equipped Items</span></h3>";
while($r=$db->fetch_row($q))
{
$equip[$r['itmid']]=$r;
}
?><div style="padding: 15px;"><center>
<table >
<tr>
	<td class='textm2' align='left' style = 'width: 300px;'>
		<table width = '100%' cellpadding=5 cellspacing=5>
			<tr>


       <td width='25%' align='center'>
			<div style="border:2px SOLID #333333; width:120px; height: 110px;">
               	<font size = '-2' style = 'margin-top: 10px;'>[b]Bracelet[/b]</font>
			    <div id = 'sec5' align = 'center'>
					<table width = '100%' valign = 'bottom'>
						<tr>
							<td align = 'center'>
<?PHP if($equip[$ir['equip_bracelet']]['itmid'])
{ ?>
		<?php echo "[img=itmpics/{$i[]"; ?>
</a>
<?php } else {echo "[img=itmpics/noitem.jpg]";} ?>
						</td>
						</tr>
						<tr>
							<td align = 'center'></td>
						<tr>

							<td align = 'center'>
                					 <span style = 'font-size: xx-small;'>[[url='unequip.php?type=equip_bracelet']Unequip[/url]]</span>								</td>
						</tr>
					</table>
				</div>
			</div>
           </td>



       <td width='25%' align='center'>
			<div style="border:2px SOLID #333333; width:120px; height: 110px;">
               	<font size = '-2' style = 'margin-top: 10px;'>[b]Helmet[/b]</font>
			    <div id = 'sec5' align = 'center'>
					<table width = '100%' valign = 'bottom'>
						<tr>
							<td align = 'center'>
<?PHP if($equip[$ir['equip_helmet']]['itmid'])
{ ?>
		<?php echo "[img=itmpics/{$i[]"; ?>
</a>
	<?php } else {echo "[img=itmpics/noitem.jpg]";} ?>	


	</td>
						</tr>
						<tr>
							<td align = 'center'></td>
						<tr>

							<td align = 'center'>
                					 <span style = 'font-size: xx-small;'>[[url='unequip.php?type=equip_helmet']Unequip[/url]]</span>								</td>
						</tr>
					</table>
				</div>
			</div>
           </td>





<td width='25%' align='center'>
			<div style="border:2px SOLID #333333; width:120px; height: 110px;">
               	<font size = '-2' style = 'margin-top: 10px;'>[b]Amulet[/b]</font>
			    <div id = 'sec5' align = 'center'>
					<table width = '100%' valign = 'bottom'>
						<tr>
							<td align = 'center'>
<?PHP if($equip[$ir['equip_amulet']]['itmid'])
{ ?>
		<?php echo "[img=itmpics/{$i[]"; ?>
</a>
	<?php } else {echo "[img=itmpics/noitem.jpg]";} ?>	
						</td>
						</tr>
						<tr>
							<td align = 'center'></td>
						<tr>

							<td align = 'center'>
                					 <span style = 'font-size: xx-small;'>[[url='unequip.php?type=equip_amulet']Unequip[/url]]</span>								</td>
						</tr>
					</table>
				</div>
			</div>
           </td>




       </tr><tr>		  	


       <td width='25%' align='center'>
			<div style="border:2px SOLID #333333; width:120px; height: 110px;">
               	<font size = '-2' style = 'margin-top: 10px;'>[b]Primary Weapon[/b]</font>
			    <div id = 'sec5' align = 'center'>
					<table width = '100%' valign = 'bottom'>
						<tr>
							<td align = 'center'>
<?PHP if($equip[$ir['equip_primary']]['itmid'])
{ ?>
		<?php echo "[img=itmpics/{$i[]"; ?>
</a>
	<?php } else {echo "[img=itmpics/noitem.jpg]";} ?>	
						</td>
						</tr>
						<tr>
							<td align = 'center'></td>
						<tr>

							<td align = 'center'>
                					 <span style = 'font-size: xx-small;'>[[url='unequip.php?type=equip_primary']Unequip[/url]]</span>								</td>
						</tr>
					</table>
				</div>
			</div>
           </td>




       <td width='25%' align='center'>
			<div style="border:2px SOLID #333333; width:120px; height: 110px;">
               	<font size = '-2' style = 'margin-top: 10px;'>[b]Body Armour[/b]</font>
			    <div id = 'sec5' align = 'center'>
					<table width = '100%' valign = 'bottom'>
						<tr>
							<td align = 'center'>
<?PHP if($equip[$ir['equip_armor']]['itmid'])
{ ?>
		<?php echo "[img=itmpics/{$i[]"; ?>
</a>
	<?php } else {echo "[img=itmpics/noitem.jpg]";} ?>	
						</td>
						</tr>
						<tr>
							<td align = 'center'></td>
						<tr>

							<td align = 'center'>
                					 <span style = 'font-size: xx-small;'>[[url='unequip.php?type=equip_armor']Unequip[/url]]</span>								</td>
						</tr>
					</table>
				</div>
			</div>
           </td>






       <td width='25%' align='center'>
			<div style="border:2px SOLID #333333; width:120px; height: 110px;">
               	<font size = '-2' style = 'margin-top: 10px;'>[b]Secondary Weapon[/b]</font>
			    <div id = 'sec5' align = 'center'>
					<table width = '100%' valign = 'bottom'>
						<tr>
							<td align = 'center'>
<?PHP if($equip[$ir['equip_secondary']]['itmid'])
{ ?>
		<?php echo "[img=itmpics/{$i[]"; ?>
</a>
	<?php } else {echo "[img=itmpics/noitem.jpg]";} ?>	
						</td>
						</tr>
						<tr>
							<td align = 'center'></td>
						<tr>

							<td align = 'center'>
                					 <span style = 'font-size: xx-small;'>[[url='unequip.php?type=equip_secondary']Unequip[/url]]</span>								</td>
						</tr>
					</table>
				</div>
			</div>
           </td>


       </tr><tr>		  	


       <td width='25%' align='center'>
			<div style="border:2px SOLID #333333; width:120px; height: 110px;">
               	<font size = '-2' style = 'margin-top: 10px;'>[b]Ring[/b]</font>
			    <div id = 'sec5' align = 'center'>
					<table width = '100%' valign = 'bottom'>
						<tr>
							<td align = 'center'>
<?PHP if($equip[$ir['equip_ring']]['itmid'])
{ ?>
		<?php echo "[img=itmpics/{$i[]"; ?>
</a>
	<?php } else {echo "[img=itmpics/noitem.jpg]";} ?>	
						</td>
						</tr>
						<tr>
							<td align = 'center'></td>
						<tr>

							<td align = 'center'>
                					 <span style = 'font-size: xx-small;'>[[url='unequip.php?type=equip_ring']Unequip[/url]]</span>								</td>
						</tr>
					</table>
				</div>
			</div>
           </td>




       <td width='25%' align='center'>
			<div style="border:2px SOLID #333333; width:120px; height: 110px;">
               	<font size = '-2' style = 'margin-top: 10px;'>[b]Boots[/b]</font>
			    <div id = 'sec5' align = 'center'>
					<table width = '100%' valign = 'bottom'>
						<tr>
							<td align = 'center'>
<?PHP if($equip[$ir['equip_boots']]['itmid'])
{ ?>
		<?php echo "[img=itmpics/{$i[]"; ?>
</a>
	<?php } else {echo "[img=itmpics/noitem.jpg]";} ?>	
					</td>
						</tr>
						<tr>
							<td align = 'center'></td>
						<tr>

							<td align = 'center'>
                					 <span style = 'font-size: xx-small;'>[[url='unequip.php?type=equip_boots']Unequip[/url]]</span>								</td>
						</tr>
					</table>
				</div>
			</div>
           </td>





       <td width='25%' align='center'>
			<div style="border:2px SOLID #333333; width:120px; height: 110px;">
               	<font size = '-2' style = 'margin-top: 10px;'>[b]Special Item[/b]</font>
			    <div id = 'sec5' align = 'center'>
					<table width = '100%' valign = 'bottom'>
						<tr>
							<td align = 'center'>
<?PHP if($equip[$ir['equip_special']]['itmid'])
{ ?>

		<?php echo "[img=itmpics/{$i[]"; ?>
</a>
	<?php } else {echo "[img=itmpics/noitem.jpg]";} ?>	
					</td>
						</tr>
						<tr>
							<td align = 'center'></td>
						<tr>

							<td align = 'center'>
                					 <span style = 'font-size: xx-small;'>[[url='unequip.php?type=equip_special']Unequip[/url]]</span>								</td>
						</tr>
					</table>
				</div>
			</div>
           </td>


</tr>
         </table>
	</td>

  </tr>
		</table></center>
</div><hr />
<h3><span style='text-decoration: none; font-size: 14px; font-weight: 600'>Inventory</span></h3><hr />
<? $inv=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_userid={$userid} ORDER BY i.itmtype ASC, i.itmname ASC");
if ($db->num_rows($inv) == 0)
{
print "[b]You have no items![/b]";
}
else
{
print "[b]Your items are listed below.[/b]

<table width=100% class=\"table10\" border=\"0\" cellspacing=\"1\">
<tr>
<td class=\"h\">Item Image</td>
<td class=\"h\">Sell Value</td>
<td class=\"h\">Total Sell Value</td>
<td class=\"h\">Item Name</td>
<td class=\"h\">Actions</td>
</tr>";
$lt="";
while($i=$db->fetch_row($inv))
{
if($lt!=$i['itmtypename'])
{
$lt=$i['itmtypename'];
print "\n<tr><td colspan=5><font color='red'>{$lt}</font></td></tr>";
}
if($i['weapon'])
{
 $i['itmname']="<font color='red'>*</font>".$i['itmname'];
}
if($i['armor'])
{
 $i['itmname']="<font color='green'>*</font>".$i['itmname'];
}
if($i['helmet'])
{
 $i['itmname']="<font color='blue'>*</font>".$i['itmname'];
}
if($i['boots'])
{
 $i['itmname']="<font color='pink'>*</font>".$i['itmname'];
}
if($i['amulet'])
{
 $i['itmname']="<font color='brown'>*</font>".$i['itmname'];
}
if($i['bracelet'])
{
 $i['itmname']="<font color='yellow'>*</font>".$i['itmname'];
}
if($i['ring'])
{
 $i['itmname']="<font color='lime'>*</font>".$i['itmname'];
}
if($i['special'])
{
 $i['itmname']="<font color='darkorange'>*</font>".$i['itmname'];
}
print "<tr><td>[img=itmpics/{$i[]";
if ($i['inv_qty'] > 1)
{
print " x{$i['inv_qty']}";
}
print "</td><td>\${$i['itmsellprice']}</td><td>";
print "$".($i['itmsellprice']*$i['inv_qty']);
print"</td><td>{$i['itmname']}";
print "</td><td>| [url='iteminfo.php?ID={$i[']Info[/url] | [url='itemsend.php?ID={$i[']Send[/url] | [url='itemsell.php?ID={$i[']Sell[/url] | [url='imadd.php?ID={$i[']Add To Market[/url] |";
$usershop=$db->query("select * from usershops where userid=$userid");
if(mysql_num_rows($usershop)!=0)
{
$addtoshop="[url='addtoshop.php?ID={$i['] Put in Shop[/url] |";
print"$addtoshop";
}
if($i['effect1_on'] || $i['effect2_on'] || $i['effect3_on']) {
print " [url='itemuse.php?ID={$i[']Use[/url] |";
}
if($ir['gang']>0 && $gangdata['gangARMORY']==1 && $i['inv_lent']==0)
{
print "  [url='donateitem.php?ID={$i[']Donate To Gang[/url] |";
}
if($ir['gang']>0 && $gangdata['gangARMORY']==1 && $i['inv_lent']>0)
{
print "  [url='giveback.php?ID={$i[']Give Back[/url] |";
}
if($i['itmtypename'] == 'Food' || $i['itmtypename'] == 'Medical' || $i['itmtypename'] == 'Donator Pack')

if($i['effect1_on'] || $i['effect2_on'] || $i['effect3_on']) {
print "  [url='itemuse.php?ID={$i[']Use[/url] |";
}
if($i['weapon'])
{
print " 
- [url='equip_weapon.php?ID={$i[']Equip as Weapon[/url] -";
}
if($i['armor'])
{
print " 
- [url='equip_armor.php?ID={$i[']Equip as Armor[/url] -";
}
if($i['helmet'])
{
print " 
- [url='equip_helmet.php?ID={$i[']Equip as Helmet[/url] -";
}
if($i['boots'])
{
print " 
- [url='equip_boots.php?ID={$i[']Equip as Boots[/url] -";
}
if($i['amulet'])
{
print " 
- [url='equip_amulet.php?ID={$i[']Equip as Amulet[/url] -";
}
if($i['bracelet'])
{
print " 
- [url='equip_bracelet.php?ID={$i[']Equip as Bracelet[/url] -";
}
if($i['ring'])
{
print " 
- [url='equip_ring.php?ID={$i[']Equip as Ring[/url] -";
}
if($i['special'])
{
print " 
- [url='equip_special.php?ID={$i[']Equip as Special Item[/url] -";
}
print "</td></tr>";
}
print "</table>";
print "<small>[b]Note:[/b]
Some items are not what they appear to be.";
}
?>
Posted

Re: Inventory pic, 2 bucks for a small fix.

Correct me if I'm wrong but shouldn't this line:

 

<?php echo "[img=itmpics/{$i[]"; ?>

 

Be:

 

<?php echo "[img=itmpics/{$ir[]"; ?>

 

Or:

 

<?php echo "[img=itmpics/{$r[]"; ?>

 

NOTE: I got it wrong just realized it was item pics, what images are in your DB?

Posted

Re: Inventory pic, 2 bucks for a small fix.

foreach of the equip items add this code, you may need to change the name of the itmpic if you have it called differently.

 

echo '[img=itmpics/'.(($equip[$ir['equip_bracelet']]['itmpic']) ? $equip[$ir['equip_bracelet']]['itmpic'] : 'noitem.jpg').']'; 

// if that dont work you could check where
// abouts the values are by using this..
echo '<pre>'; print_r($equip); echo '</pre>';

 

*by the way, there was a tip for a easier way to do it in bold ;)

Posted

Re: Inventory pic, 2 bucks for a small fix.

POG1, thank you that did the trick. I'd try what you suggested but at this moment i really have no time to learn, this fascinates me tho.

Pls pm me your pp address I'll send you 5 bucks.

thx to anyone else that tried to help too, you guys are great i love this forum!

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