Blackdogg Posted April 28, 2009 Posted April 28, 2009 Hi everyone i was just wondering if it was possible to be able to add items to the game that would only be useable by users over a certain level and if anyone can help me with the coding of it. Im guessing you would put a snippet of code into the itemuse.php or inventory.php something like if ($i['itmid'] == **&($i['level']>**) { print " [<a>Use</a>]"; Or am im completley utterly and totaly going in the wrong direction lol :roll: Quote
Guest Anonymous Posted April 29, 2009 Posted April 29, 2009 Re: Level specific items You're going in the right direction, fixed the code up a little: if($i['itmid'] == x && $ir['userid'] > x){ echo '[url=""]Use[/url]'; } You would need to add it to both files. Quote
AlabamaHit Posted April 29, 2009 Posted April 29, 2009 Re: Level specific items lol, small typo there Z3ON if($i['itmid'] == ID && $ir['level'] >= LEVEL) { echo "[url='']User[/url]"; } Quote
Guest Anonymous Posted April 29, 2009 Posted April 29, 2009 Re: Level specific items Not really, pretty sure the OP understood what i meant; though the way you have put it, it's easier to understand. Quote
gideon prewett Posted April 29, 2009 Posted April 29, 2009 Re: Level specific items wouldnt it be better to add somthing to staff_item.php so when u fill in the form for a new item there is a section to say what lvl u have to be? i dunno how just an idea lol Quote
glg216 Posted May 10, 2009 Posted May 10, 2009 Re: Level specific items the way i did it on my site is add another field in your sql. name it min_lvl. when they try to equip it do check for the min_lvl and the lvl of the user. Quote
Blackdogg Posted May 14, 2009 Author Posted May 14, 2009 Re: Level specific items so why dont you share your bit of coding with us then :) Quote
TMan Posted May 15, 2009 Posted May 15, 2009 Re: Level specific items Its just a check for lvl like housing. Look at your db at the housing it has min lvl. Add that to items in the db. (Ilvl for example) Add an update query to staff_item.php(and a txt box) Then add something like: $itlvl=mysql_query("SELECT * FROM items WHERE Ilvl<={$ir['level']}",$c); $itl=mysql_fetch_array($itlvl); To your itembuy.php or itemmarket.php not sure(cba 2 w/o $$ lol) And add lvl checks to stop 'illegal' buys. Its basically the exact same as housing(estate.php) More work but worth it if you want the luxury of adding min lvl to each item. Quote
glg216 Posted May 16, 2009 Posted May 16, 2009 Re: Level specific items this is where i updated it in the equip_weapon.php file. like i said i added a sql field to the item. that way you can also restrict other items and not just the weapons if(!in_array($_GET['type'], array("equip_primary", "equip_secondary"))) { print "This slot ID is not valid."; print " [url='inventory.php']>Back to Inventory[/url]"; $h->endpage(); exit; } // start $wepn = $r['itmminlvl']; $ulvl = $ir['level']; if ($ulvl < $wepn){ Print "you cant equipt this iteam, you dont meet the minum requirments. you are {$ir['level']}you need level to be level {$r['itmminlvl']}"; $h->endpage(); exit; } Quote
Blackdogg Posted June 24, 2009 Author Posted June 24, 2009 Re: Level specific items ok i went off this mod for a while but thought id give it another go maybe if i explain abit clearer what i want someone might help me :) I already have the mod for items needed for crimes now what i want is to make items for specific lvls for specific crimes. now you dont actually use the item needed for the crime you just need it in your inventory so how can i stop a lvl 10 player having a lvl 20 item Quote
Lowball Posted September 5, 2009 Posted September 5, 2009 Re: Level specific items I cannot give you the exact code I used because my version is quite different than the original, but: 1) Create a new field in the items table, for minimum_level (or whatever name you choose) (integer, default value=0) 2) Edit staff_items.php where you create a new item, and when you edit an item, to allow for an integer to be placed here 3) Modify the "use item" (not just the menu display in inventory, but the actual itemuse.php as well to prevent people from trying to get around the menus 4) Modify the equipt item, and equipt armor files as well. Beyond this, you might want to add a column in the shops listing the minimum level, as well as in the auction and items market, otherwise players will complain that they spent good money on an item they cannot use. 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.