/item Plus limit question

06/15/2009 00:17 ~RapidBlade~#1
Hey guys, I was wondering if someone could help me make it so normal players can use /item , but it was limited to +9. im making a pvp server and i dont want every1 to get +12s with this command, so if u can help it b appreciated =)

Here is the original command:

Code:
                                        if (Splitter[0] == "/item")
                                        {
                                            Ini ItemNames = new Ini(System.Windows.Forms.Application.StartupPath + @"\ItemNamesToId.ini");
                                            string ItemName = Splitter[2];
                                            string ItemQuality = Splitter[1];
                                            byte Plus = byte.Parse(Splitter[3]);
                                            byte Bless = byte.Parse(Splitter[4]);
                                            byte Enchant = byte.Parse(Splitter[5]);
                                            byte Soc1 = byte.Parse(Splitter[6]);
                                            byte Soc2 = byte.Parse(Splitter[7]);

                                            uint ItemId = 0;
                                            ItemId = uint.Parse(ItemNames.ReadValue("Items", ItemName));

                                            if (ItemId == 0)
                                                return;

                                            byte Quality = 1;

                                            if (ItemQuality == "One")
                                                Quality = 1;
                                            else if (ItemQuality == "Normal")
                                                Quality = 5;
                                            else if (ItemQuality == "Unique")
                                                Quality = 7;
                                            else if (ItemQuality == "Refined")
                                                Quality = 6;
                                            else if (ItemQuality == "Elite")
                                                Quality = 8;
                                            else if (ItemQuality == "Super")
                                                Quality = 9;
                                            else
                                                Quality = (byte)Other.ItemQuality(ItemId);

                                            ItemId = Other.ItemQualityChange(ItemId, Quality);

                                            if (MyChar.ItemsInInventory < 40)
                                                MyChar.AddItem(ItemId.ToString() + "-" + Plus.ToString() + "-" + Bless.ToString() + "-" + Enchant.ToString() + "-" + Soc1.ToString() + "-" + Soc2.ToString(), 0, (uint)General.Rand.Next(57458353));
                                        }
06/15/2009 00:23 Incariuz#2
Copy the entire command.

Search

Code:
if (Status == 8 || Status == 7)
And paste it above that. That small line makes it read if you're a gm or pm.
06/15/2009 00:26 ~RapidBlade~#3
No i meen, i want normal players to b able to use it but i dont want them to b able to code +12s only up to +9
06/15/2009 00:29 Incariuz#4
I just told you how to make it so players can use it. As for them not being able to create over +9. I have no clue, and I don't work with LOTF anymore so... That's all the help I'm able to offer.
06/15/2009 00:30 damianpesta#5
Quote:
Originally Posted by ~RapidBlade~ View Post
No i meen, i want normal players to b able to use it but i dont want them to b able to code +12s only up to +9
if (Item.Pluss <= 9)
return;
And send message that your not able to make any +10...
06/15/2009 00:31 _Emme_#6
Quote:
if (Plus > 9)
Plus = 9;
Add that anywhere above the AddItem code.
06/15/2009 00:32 ~RapidBlade~#7
Thanks Emme and damian =)
06/15/2009 01:31 damianpesta#8
Quote:
Originally Posted by ~RapidBlade~ View Post
Thanks Emme and damian =)
Ouch I didnt realize how many typo's I made LOL.Damn funny now.
06/15/2009 01:45 kinshi88#9
byte Plus = Math.Min(byte.Parse(Splitter[3]), 9);

Or the other way around, something like that =P
06/15/2009 01:56 _tao4229#10
Code:
byte Plus = Status >= 7 ? Math.Min(byte.Parse(Splitter[4]), 9) : Math.Min(byte.Parse(Splitter[4]), 12);
Combined all the ideas of the thread into one line of code.