Requesting This Kind of Script

Reins

New member
Messages
99
Points
0
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

 
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.

Code:
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;}
 
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

 
cartlist,itemlist and storagelist works only if the player is online. My script will query the item info in the database.

 
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.. 

67ku9v.jpg


 
Last edited by a moderator:
Back
Top