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?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..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;}
We use essential cookies to make this site work, and optional cookies to enhance your experience.