Jump to content
MakeWebGames

Recommended Posts

Posted

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:

Guest Anonymous
Posted

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.

Guest Anonymous
Posted

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.

  • 2 weeks later...
Posted

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.

Posted

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.

Posted

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;
}
  • 1 month later...
Posted

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

  • 2 months later...
Posted

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.

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