Reins 3 Posted November 22, 2013 Hi,Can i request a npc like thisa npc will ask a char name then when confirmed that it is existing it will show all items and storage in a list thanks Quote Share this post Link to post Share on other sites
0 Patskie 88 Posted November 22, 2013 Note that querying through the database is not updated from time to time. It has an interval. I intended to use query_sql though there are some commands like storagelist, cartlist etc. to be able to cater offline players. prontera,150,150,0 script Sample 123,{ .npc$ = "[ " +strnpcinfo(1)+ " ]"; mes .npc$; mes "Enter a character name"; next; input .@name$; if ( !query_sql("SELECT `char_id` FROM `char` WHERE `name` = '" +escape_sql(.@name$)+ "'") ) { mes .npc$; mes "Character doesn't exist"; close; } query_sql "SELECT `account_id`, `char_id` FROM `char` WHERE `name` = '" +escape_sql(.@name$)+ "'",.@aid,.@cid; query_sql "SELECT `nameid`, `amount` FROM `storage` WHERE `account_id` = '" +.@aid+ "'",.@items, .@sa; query_sql "SELECT `nameid`, `amount` FROM `inventory` WHERE `char_id` = '" +.@cid+ "'",.@invitems, .@ia; mes .npc$; mes "Here are the list of " +.@name$+ "'s items"; next; mes .npc$; mes "Storage inventory : "; for ( .@i = 0; .@i < getarraysize(.@items); .@i++ ) mes "> (" +.@sa[.@i]+ ") " +getitemname(.@items[.@i]); next; mes .npc$; mes "Item inventory : "; for ( .@x = 0; .@x < getarraysize(.@invitems); .@x++ ) mes "> (" +.@ia[.@x]+ ") " +getitemname(.@invitems[.@x]); if ( checkcart() ) { next; mes .npc$; mes "Cart inventory : "; query_sql "SELECT `nameid`, `amount` FROM `cart_inventory` WHERE `char_id` = '" +.@cid+ "'",.@ci, .@ca; for ( .@y = 0; .@y < getarraysize(.@ci); .@y++ ) mes "> (" +.@ca[.@y]+ ") " +getitemname(.@ci[.@y]); } close;} Quote Share this post Link to post Share on other sites
0 kerbiii 5 Posted November 23, 2013 Note that querying through the database is not updated from time to time. It has an interval. I intended to use query_sql though there are some commands like storagelist, cartlist etc. to be able to cater offline players. prontera,150,150,0 script Sample 123,{ .npc$ = "[ " +strnpcinfo(1)+ " ]"; mes .npc$; mes "Enter a character name"; next; input .@name$; if ( !query_sql("SELECT `char_id` FROM `char` WHERE `name` = '" +escape_sql(.@name$)+ "'") ) { mes .npc$; mes "Character doesn't exist"; close; } query_sql "SELECT `account_id`, `char_id` FROM `char` WHERE `name` = '" +escape_sql(.@name$)+ "'",.@aid,.@cid; query_sql "SELECT `nameid`, `amount` FROM `storage` WHERE `account_id` = '" +.@aid+ "'",.@items, .@sa; query_sql "SELECT `nameid`, `amount` FROM `inventory` WHERE `char_id` = '" +.@cid+ "'",.@invitems, .@ia; mes .npc$; mes "Here are the list of " +.@name$+ "'s items"; next; mes .npc$; mes "Storage inventory : "; for ( .@i = 0; .@i < getarraysize(.@items); .@i++ ) mes "> (" +.@sa[.@i]+ ") " +getitemname(.@items[.@i]); next; mes .npc$; mes "Item inventory : "; for ( .@x = 0; .@x < getarraysize(.@invitems); .@x++ ) mes "> (" +.@ia[.@x]+ ") " +getitemname(.@invitems[.@x]); if ( checkcart() ) { next; mes .npc$; mes "Cart inventory : "; query_sql "SELECT `nameid`, `amount` FROM `cart_inventory` WHERE `char_id` = '" +.@cid+ "'",.@ci, .@ca; for ( .@y = 0; .@y < getarraysize(.@ci); .@y++ ) mes "> (" +.@ca[.@y]+ ") " +getitemname(.@ci[.@y]); } close;} how does this work? is it like @itemlist @cartlist or is it like alt + e , alt + w Quote Share this post Link to post Share on other sites
0 Reins 3 Posted November 23, 2013 thanks lemme try this =) Quote Share this post Link to post Share on other sites
0 Patskie 88 Posted November 23, 2013 cartlist,itemlist and storagelist works only if the player is online. My script will query the item info in the database. Quote Share this post Link to post Share on other sites
0 WalkingBad 0 Posted April 30, 2014 (edited) Note that querying through the database is not updated from time to time. It has an interval. I intended to use query_sql though there are some commands like storagelist, cartlist etc. to be able to cater offline players. prontera,150,150,0 script Sample 123,{ .npc$ = "[ " +strnpcinfo(1)+ " ]"; mes .npc$; mes "Enter a character name"; next; input .@name$; if ( !query_sql("SELECT `char_id` FROM `char` WHERE `name` = '" +escape_sql(.@name$)+ "'") ) { mes .npc$; mes "Character doesn't exist"; close; } query_sql "SELECT `account_id`, `char_id` FROM `char` WHERE `name` = '" +escape_sql(.@name$)+ "'",.@aid,.@cid; query_sql "SELECT `nameid`, `amount` FROM `storage` WHERE `account_id` = '" +.@aid+ "'",.@items, .@sa; query_sql "SELECT `nameid`, `amount` FROM `inventory` WHERE `char_id` = '" +.@cid+ "'",.@invitems, .@ia; mes .npc$; mes "Here are the list of " +.@name$+ "'s items"; next; mes .npc$; mes "Storage inventory : "; for ( .@i = 0; .@i < getarraysize(.@items); .@i++ ) mes "> (" +.@sa[.@i]+ ") " +getitemname(.@items[.@i]); next; mes .npc$; mes "Item inventory : "; for ( .@x = 0; .@x < getarraysize(.@invitems); .@x++ ) mes "> (" +.@ia[.@x]+ ") " +getitemname(.@invitems[.@x]); if ( checkcart() ) { next; mes .npc$; mes "Cart inventory : "; query_sql "SELECT `nameid`, `amount` FROM `cart_inventory` WHERE `char_id` = '" +.@cid+ "'",.@ci, .@ca; for ( .@y = 0; .@y < getarraysize(.@ci); .@y++ ) mes "> (" +.@ca[.@y]+ ") " +getitemname(.@ci[.@y]); } close;} how to make this script that only gm's can talk to this NPC? this is a great npc.. and there's a little prob.. Edited April 30, 2014 by WalkingBad Quote Share this post Link to post Share on other sites
Hi,
Can i request a npc like this
a npc will ask a char name then when confirmed that it is existing it will show all items and storage in a list thanks
Share this post
Link to post
Share on other sites