Jump to content
  • 0
Reins

Requesting This Kind of Script

Question

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

5 answers to this question

Recommended Posts

  • 0

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

Share this post


Link to post
Share on other sites
  • 0

 

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

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

 

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

Edited by WalkingBad

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.