Jump to content

Question

Posted

i have problem i line tiara can help me? pls

 

else if (command.startsWith("become_noble"))

{

NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());

if (!player.isNoble())

{

//then you check for the level 78

if(player.getLevel()>=78){

 

//then you ask for items

if(

player.getInventory().getItemByItemId(12345/**1 item id **/).getCount()>=12345/** Is bigger or equals required item count **/

&& player.getInventory().getItemByItemId(12345/**2 item id **/).getCount()>=12345/** Is bigger or equals required item count **/

&& player.getInventory().getItemByItemId(12345/**3 item id **/).getCount()>=12345/** Is bigger or equals required item count **/

&& player.getInventory().getItemByItemId(12345/**4 item id **/).getCount()>=12345/** Is bigger or equals required item count **/

){

L2ItemInstance tiara = player.getInventory().addItem("tiara", 7694, 1, player, null);//give nobless tiara

player.getInventory().equipItemAndRecord(tiara);//equip the tiara if you want

player.setNoble(true, true);

player.sendPacket(new UserInfo(player));

html.setFile("data/html/classmaster/nobleok.htm");

}else

player.sendMessage("You don't have enough items.");

}

else

player.sendMessage("Your level must be 78 or higher.");

}

else

html.setFile("data/html/classmaster/alreadynoble.htm");

 

player.sendPacket(html);

//and don't forget the imports for l2iteminstance etc..

}

 

 

Recommended Posts

  • 0
Posted

Ok, so its noblesse npc?

....

 

                  //then you ask for items                  
                  if(
                  player.getInventory().getItemByItemId(12345/**1 item id **/).getCount()>=12345/** Is bigger or equals required item count **/
                  && player.getInventory().getItemByItemId(12345/**2 item id **/).getCount()>=12345/** Is bigger or equals required item count **/
                  && player.getInventory().getItemByItemId(12345/**3 item id **/).getCount()>=12345/** Is bigger or equals required item count **/   
                  && player.getInventory().getItemByItemId(12345/**4 item id **/).getCount()>=12345/** Is bigger or equals required item count **/   
                  ){

 

Dude read this part...

  • 0
Posted

yes is npc noble i have problem in line tiara anyone can repair pls! and send me

 

Show me the error... becouse as i  read i can't find anything wrong but the one i already show.

 

Edit try:

                  L2ItemInstance tiara = player.getInventory().addItem("tiara", 7694, 1, player, null);//give nobless tiara

				 	player.getInventory().addItem("tiara", 7694, 1, player, null);//give nobless tiara

  • 0
Posted

first of all using getItemById(222).getCount sucks since player may have not item with 222 ID in his inventory so .getCount is undifined. So use like:

 

if getItemById(222) != null

  if getItemById(222) >= 12345

        .

        .

        .

 

 

  • 0
Posted

first of all using getItemById(222).getCount sucks since player may have not item with 222 ID in his inventory so .getCount is undifined. So use like:

 

if getItemById(222) != null

  if getItemById(222) >= 12345

        .

        .

        .

 

                  }else
                     player.sendMessage("You don't have enough items.");

  • 0
Posted

                  }else
                     player.sendMessage("You don't have enough items.");

 

else if (command.startsWith("become_noble"))

{

NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());

if (!player.isNoble())

{

//then you check for the level 78

if(player.getLevel()>=78){

 

//then you ask for items

if(

player.getInventory().getItemByItemId(9210/**1 item id **/).getCount()>=9210/** Is bigger or equals required item count **/

&& player.getInventory().getItemByItemId(9211/**2 item id **/).getCount()>=9211/** Is bigger or equals required item count **/

&& player.getInventory().getItemByItemId(9212/**3 item id **/).getCount()>=9212/** Is bigger or equals required item count **/

&& player.getInventory().getItemByItemId(9213/**4 item id **/).getCount()>=9213/** Is bigger or equals required item count **/

){

player.setNoble(true, true);

player.getInventory().addItem("tiara", 7694, 1, player, null);//give nobless tiara

player.sendPacket(new UserInfo(player));

html.setFile("data/html/classmaster/nobleok.htm");

}else

player.sendMessage("You don't have enough items.");

}

else

player.sendMessage("Your level must be 78 or higher.");

}

else

html.setFile("data/html/classmaster/alreadynoble.htm");

 

player.sendPacket(html);

//and don't forget the imports for l2iteminstance etc..

}

 

and me go speak with npc and say me: You don't have enough items ... who is?

  • 0
Posted

               player.getInventory().getItemByItemId(9210/**1 item id **/).getCount()>=9210/** Is bigger or equals required item count **/
               && player.getInventory().getItemByItemId(9211/**2 item id **/).getCount()>=9211/** Is bigger or equals required item count **/
               && player.getInventory().getItemByItemId(9212/**3 item id **/).getCount()>=9212/** Is bigger or equals required item count **/   
               && player.getInventory().getItemByItemId(9213/**4 item id **/).getCount()>=9213/** Is bigger or equals required item count **/   

 

You request  9213 count from item 9213. And so on with all else...

 

 

  • 0
Posted

why don't you try to make this?

first of all using getItemById(222).getCount sucks since player may have not item with 222 ID in his inventory so .getCount is undifined. So use like:

 

if getItemById(222) != null

  if getItemById(222) >= 12345

        .

        .

        .

        .

        .

        .

  • 0
Posted

dont work

 

Man consider learning some more english becouse I am not able to understand what are your error in this case?

As i see the only problem could be in this lines:

   //then you ask for items                  
                  if(
                  player.getInventory().getItemByItemId(12345/**1 item id **/).getCount()>=12345/** Is bigger or equals required item count **/
                  && player.getInventory().getItemByItemId(12345/**2 item id **/).getCount()>=12345/** Is bigger or equals required item count **/
                  && player.getInventory().getItemByItemId(12345/**3 item id **/).getCount()>=12345/** Is bigger or equals required item count **/   
                  && player.getInventory().getItemByItemId(12345/**4 item id **/).getCount()>=12345/** Is bigger or equals required item count **/   
                  ){
                  L2ItemInstance tiara = player.getInventory().addItem("tiara", 7694, 1, player, null);//give nobless tiara
                  player.getInventory().equipItemAndRecord(tiara);//equip the tiara if you want
                  player.setNoble(true, true);
                  player.sendPacket(new UserInfo(player));
                  html.setFile("data/html/classmaster/nobleok.htm");
                  }else
                     player.sendMessage("You don't have enough items.");

 

But without error, or good description what exacly happend when you click/talk with the NPC...

 

 

  • 0
Posted

Man consider learning some more english becouse I am not able to understand what are your error in this case?

As i see the only problem could be in this lines:

   //then you ask for items                  
                  if(
                  player.getInventory().getItemByItemId(12345/**1 item id **/).getCount()>=12345/** Is bigger or equals required item count **/
                  && player.getInventory().getItemByItemId(12345/**2 item id **/).getCount()>=12345/** Is bigger or equals required item count **/
                  && player.getInventory().getItemByItemId(12345/**3 item id **/).getCount()>=12345/** Is bigger or equals required item count **/   
                  && player.getInventory().getItemByItemId(12345/**4 item id **/).getCount()>=12345/** Is bigger or equals required item count **/   
                  ){
                  L2ItemInstance tiara = player.getInventory().addItem("tiara", 7694, 1, player, null);//give nobless tiara
                  player.getInventory().equipItemAndRecord(tiara);//equip the tiara if you want
                  player.setNoble(true, true);
                  player.sendPacket(new UserInfo(player));
                  html.setFile("data/html/classmaster/nobleok.htm");
                  }else
                     player.sendMessage("You don't have enough items.");

 

But without error, or good description what exacly happend when you click/talk with the NPC...

i talk with the NPC i click in become nobles and he say You don't have enough items and me have items.. understand?

  • 0
Posted

i talk with the NPC i click in become nobles and he say You don't have enough items and me have items.. understand?

 

Tell me what chronicle is your L2J?

  • 0
Posted

Well, he asked for the code in this topic  http://maxcheaters.com/forum/index.php?topic=271490.0 but i haven't tested it when i wrote.... so, i think he might have not changed the '12345' to item ids he wanted to ask for ?

 

 

Guest
This topic is now closed to further replies.


  • Posts

    • L2 PVPTOP - HTML DESIGN    
    • Do not trust this guy, he will scam you. I have sent proof to the mods, I have posted proof on another thread and I can send proof to anyone who DMs me. Avoid this guy. So not only did he scam me out of $51 USDTthen delete his messages and blocked me (I have proof) . You can see his Facebook group is constantly changing names depending on his most current scam. If you see this message and you still decide to go forward with sending your money to him, that’s on you. I can’t stress this enough. This guy is a scammer. 
    • So Goldbar thinks that deleted his side of the conversation makes it easier to claim he didn’t scam me. But I sent him $51 USDT to his ERC-20 account it was verified, he acted like it was fine but then deleted his messages and blocked me. Seriously do not trust this guy. 
    • Hi everyone, let me introduce myself—I'm Martin, a junior developer. I'm diving into the world of L2 servers, and honestly, I'm super overwhelmed about where to start learning the right way to set up, configure, and run a server. There are so many datapacks—free, private—but it's so much that my head feels like it's going to explode. I'm currently looking for someone or an active project willing to take me on as an intern. I'm not looking to make money—I'm just here to learn and grow out of pure passion for L2. I've already been working with L2jMobius H5. I managed to edit the Community Board, add a buffer, GM Shop, and teleports. I've also created custom NPCs for the GM Shop, and imported new custom weapons and armors—complete with original glow effects, like the Valakas and Antharas weapons. But there's still a lot I don't know, and it can get overwhelming. That’s why I’m looking for someone—or an active non-profit project—willing to take me on as an intern. I’m not looking to make money; I just want to learn, contribute, and grow out of pure passion for L2. If you’re working on a project and could use a motivated learner who’s eager to help, I’d love to connect!
    • Our next easy-botting project, Kain, is right around the corner! Launching tomorrow, Saturday, April 26th at 9:00 ET (UTC -4)! If you haven’t, check out the features and join our Discord to catch up on the latest drama. See you very soon! Read more about L2Toggle and Kain on our site and forum!  
  • Topics

×
×
  • Create New...