noddy Posted April 10, 2009 Posted April 10, 2009 Has anyone found a decent way to quantify items gained by the streets mod? Quote
Faz` Posted April 10, 2009 Posted April 10, 2009 Re: i need help again >.< Use the item_add function. Quote
noddy Posted April 10, 2009 Author Posted April 10, 2009 Re: i need help again >.< so how would i do that, which bit do i change? Quote
Faz` Posted April 10, 2009 Posted April 10, 2009 Re: i need help again >.< If I can remember what BlueDevil23 taught me correctly, it was something like this. It might be wrong, I'm still learning. Other players might be able to elaborate. item_add(UserID,ItemID,ItemQunatity); Quote
Uridium Posted April 10, 2009 Posted April 10, 2009 Re: i need help again >.< use this one its one ive amended so it updates the SQL each time something new is found. as soon as a user clicks on inventory.php it will auto update.. <?php include "globals.php"; $used=array(); $q=$db->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']; //grab sellers others $q2=$db->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']; } //if($userid == 1) //print "DEBUG: DELETE FROM inventory WHERE inv_id IN(".implode(",",$currdel).") "; $db->query("DELETE FROM inventory WHERE inv_id IN(".implode(",",$currdel).")"); //if($userid == 1) //print "DEBUG: INSERT INTO inventory VALUES('', {$r['inv_itemid']}, $userid, $amount) "; $db->query("INSERT INTO inventory VALUES('', {$r['inv_itemid']}, $userid, $amount)"); } } $equip = array( $ir['equip_primary'] => 0, $ir['equip_secondary'] => 0, $ir['equip_armor'] => 0 ); $q = $db->query("SELECT * FROM items WHERE itmid IN({$ir['equip_primary']}, {$ir['equip_secondary']}, {$ir['equip_armor']})"); while($r=$db->fetch_row($q)) { $equip[$r['itmid']]=$r; } print "<table width='75%' border='0'> <tr> <td width='25%' align='center'>[b]Primary Weapon[/b]</td> <td width='25%' align='center'>[b]Armour[/b]</td> <td width='25%' align='center'>[b]Secondary Weapon[/b]</td> </tr> <tr> <td align='center'>"; if($equip[$ir['equip_primary']]['itmpic']['itmdesc']) { print"[img=/itmpics/{$equip[$ir[]"; } else { print "No item image."; } print "</td> <td align='center'>"; if($equip[$ir['equip_armor']]['itmpic']['itmdesc']) { print"[img=/itmpics/{$equip[$ir[]"; } else { print "No item image."; } print "</td> <td align='center'>"; if($equip[$ir['equip_secondary']]['itmpic']['itmdesc']) { print"[img=/itmpics/{$equip[$ir[] {$ir['itmname']}"; } else { print "No item image."; } print "</td> </tr> <tr> <td align='center'>"; if($equip[$ir['equip_primary']]['itmid']) { print"[url='unequip.php?type=equip_primary']Unequip Item[/url]"; } else { print "Nothing equipped."; } print "</td> <td align='center'>"; if($equip[$ir['equip_armor']]['itmid']) { print"[url='unequip.php?type=equip_armor']Unequip Item[/url]"; } else { print "Nothing equipped."; } print "</td> <td align='center'>"; if($equip[$ir['equip_secondary']]['itmid']) { print"[url='unequip.php?type=equip_secondary']Unequip Item[/url]"; } else { print "Nothing equipped."; } print "</td> </tr> </table><hr width='95%'> <h3>Inventory</h3><hr width='95%'>"; $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=95% class=\"table\" border=\"0\" cellspacing=\"1\"> <tr> <td class=\"h\">Item</td> <td class=\"h\">Sell Value</td> <td class=\"h\">Total Sell Value</td> <td class=\"h\">Image</td> <td class=\"h\">Links</td> </tr>"; $lt=""; while($i=$db->fetch_row($inv)) { if($lt!=$i['itmtypename']) { $lt=$i['itmtypename']; print "\n<tr><td colspan=5>[b]{$lt}[/b]</td></tr>"; } if($i['weapon']) { $i['itmname']="<font color='red'>*</font>".$i['itmname']; } if($i['armor']) { $i['itmname']="<font color='green'>*</font>".$i['itmname']; } print "<tr><td>{$i['itmname']}"; 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>[img=itmpics/{$i[]"; print "</td><td>[[url='#']Info[/url]]"; print " [[url='itemsend.php?ID={$i[']Send[/url]] [[url='itemsell.php?ID={$i[']Sell[/url]] [[url='imadd.php?ID={$i[']Add To Market[/url]]"; 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]]"; } print " [[url='displayadd.php?ID=$userid&action=add&itm={$i[']Display[/url]]"; print "</td></tr>"; } print "</table>"; print "[size="1"][b]NB:[/b] Items with a small red [/size]<font color='red'>*</font>[size="1"] next to their name can be used as weapons in combat. Items with a small green [/size]<font color='green'>*</font>[size="1"] next to their name can be used as armor in combat.[/size] "; } $h->endpage(); ?> MAKE A BACKUP COPY OF YOUR OLD INVENTORY.PHP BEFORE OVERWRITING WITH THIS ONE. Quote
noddy Posted April 10, 2009 Author Posted April 10, 2009 Re: i need help again >.< :o omg, illusions it worked! thank you so much :p my players will be happy now ^^ Quote
noddy Posted April 10, 2009 Author Posted April 10, 2009 Re: i need help again >.< uhm does anyone know how to make attacks stalemate if it goes past attack 50 etc? Quote
Uridium Posted April 10, 2009 Posted April 10, 2009 Re: i need help again >.< Find $q=$db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid={$_GET['ID']}"); $odata=$db->fetch_row($q); $myabbr=($ir['gender']=="Male") ? "his" : "her"; $oabbr=($ir['gender']=="Male") ? "his" : "her"; if($odata['hp'] == 1) { print "<h3>You come all this way only too find your opponent unconscious. You could have stayed home and watched some TV</h3> [url='index.php'][img=messages_back_014.gif][/url]</a>"; $h->endpage(); $_SESSION['attacking']=0; $ir['attacking']=0; $db->query("UPDATE users SET attacking=0 WHERE userid=$userid"); exit; } Underneath add this the above may be slightly different to yours but the male female part is the same to look for if($_GET['nextstep'] > 50) { print"<center><h1><font color='red'>STALEMATE!</h1> <h2>This fight is going knowhere you may as well go home!</h2> [url='index.php']> Back[/url]</center>"; $h->endpage(); event_add($odata['userid'],"[url='viewuser.php?u=$userid']{$youdata['username']}[/url] Tried to beat you but stalemated.",$c); event_add($youdata['userid']," You Tried to beat [url='viewuser.php?u=$userid']{$odata['username']}[/url] but stalemated.",$c); exit; } Quote
noddy Posted April 10, 2009 Author Posted April 10, 2009 Re: i need help again >.< thanks again everyone who helped, your the best ^^ Quote
Zero-Affect Posted April 15, 2009 Posted April 15, 2009 Re: i need help again >.< this is good but couple of downfalls one being * i dislike * in anything specially a mod which can easily have it removed with 2 mins of work should work on that illusion mate Quote
dementor Posted April 15, 2009 Posted April 15, 2009 Re: i need help again >.< Just search the forums :) Quote
Strats Posted April 15, 2009 Posted April 15, 2009 Re: i need help again >.< illusions the file you posted works perfect but it has other add ons that my game does not. What is the code I need to add to my inventory to make it quantify items? Quote
dementor Posted April 15, 2009 Posted April 15, 2009 Re: i need help again >.< As said if you search feature you find a fix what your looking for :) Quote
Uridium Posted April 19, 2009 Posted April 19, 2009 Re: i need help again >.< You just need this bit $used=array(); $q=$db->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']; //grab sellers others $q2=$db->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']; } //if($userid == 1) //print "DEBUG: DELETE FROM inventory WHERE inv_id IN(".implode(",",$currdel).") "; $db->query("DELETE FROM inventory WHERE inv_id IN(".implode(",",$currdel).")"); //if($userid == 1) //print "DEBUG: INSERT INTO inventory VALUES('', {$r['inv_itemid']}, $userid, $amount) "; $db->query("INSERT INTO inventory VALUES('', {$r['inv_itemid']}, $userid, $amount)"); } } Paste afther the include "globals.php"; Quote
Strats Posted April 19, 2009 Posted April 19, 2009 Re: i need help again >.< :-) Thanks the only other quantify mods I have seen are by people with lots bad feedback Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.