ower12 Posted May 5, 2013 Share Posted May 5, 2013 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.. } Link to comment Share on other sites More sharing options...
0 JaharakaL Posted May 5, 2013 Share Posted May 5, 2013 Add the proper tag [Help] before the title for ex.[Help]i have problem Link to comment Share on other sites More sharing options...
0 Stewie Posted May 5, 2013 Share Posted May 5, 2013 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... Link to comment Share on other sites More sharing options...
0 ower12 Posted May 5, 2013 Author Share Posted May 5, 2013 yes is npc noble i have problem in line tiara anyone can repair pls! and send me Link to comment Share on other sites More sharing options...
0 Stewie Posted May 5, 2013 Share Posted May 5, 2013 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 Link to comment Share on other sites More sharing options...
0 `Heroin Posted May 5, 2013 Share Posted May 5, 2013 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 . . . Link to comment Share on other sites More sharing options...
0 Stewie Posted May 5, 2013 Share Posted May 5, 2013 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."); Link to comment Share on other sites More sharing options...
0 ower12 Posted May 6, 2013 Author Share Posted May 6, 2013 }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? Link to comment Share on other sites More sharing options...
0 Stewie Posted May 6, 2013 Share Posted May 6, 2013 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... Link to comment Share on other sites More sharing options...
0 ower12 Posted May 6, 2013 Author Share Posted May 6, 2013 I do not understand you can not edit for me? sorry for the trouble I'm new to this pd srry for my bad engish. Link to comment Share on other sites More sharing options...
0 `Heroin Posted May 6, 2013 Share Posted May 6, 2013 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 . . . . . . Link to comment Share on other sites More sharing options...
0 ower12 Posted May 7, 2013 Author Share Posted May 7, 2013 dont work Link to comment Share on other sites More sharing options...
0 Stewie Posted May 7, 2013 Share Posted May 7, 2013 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... Link to comment Share on other sites More sharing options...
0 ower12 Posted May 7, 2013 Author Share Posted May 7, 2013 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? Link to comment Share on other sites More sharing options...
0 Stewie Posted May 7, 2013 Share Posted May 7, 2013 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? Link to comment Share on other sites More sharing options...
0 povis111 Posted May 8, 2013 Share Posted May 8, 2013 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 ? Link to comment Share on other sites More sharing options...
Question
ower12
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..
}
Link to comment
Share on other sites
18 answers to this question
Recommended Posts