Jump to content
  • 0

Question

Posted

Hey guys so I have this script and Im having issues with it when displaying the required amount and the item names.

Can someone give me an example on how to do it?

setarray .ID,501,502,503,504,505;
setarray .AM,1,2,3,4,5;

And it will display like this when the player dont have enough of the requirements.

You are missing the following items
1 x Red Potion
2 x Orange Potion
2 x Yellow Potion
4 x White Potion
1 x Blue Potion

 

2 answers to this question

Recommended Posts

  • 1
Posted
setarray .ID[0],501,502,503,504,505;
setarray .AM[0],1,2,3,4,5;

for ( .@i = 0; .@i < 5; .@i++ ) {
	if (countitem(.ID[.@i]) < .AM[.@i])
		.@missing$ += (.AM[.@i] - countitem(.ID[.@i])) + " x " + getitemname(.ID[.@i]) + "\n";
}
if (.@missing$ != "") {
	mes "You are missing the following items:";
	mes .@missing$;
	close;
}

 

  • Upvote 1
  • 0
Posted
6 minutes ago, Capuche said:

setarray .ID[0],501,502,503,504,505;
setarray .AM[0],1,2,3,4,5;

for ( .@i = 0; .@i < 5; .@i++ ) {
	if (countitem(.ID[.@i]) < .AM[.@i])
		.@missing$ += (.AM[.@i] - countitem(.ID[.@i])) + " x " + getitemname(.ID[.@i]) + "\n";
}
if (.@missing$ != "") {
	mes "You are missing the following items:";
	mes .@missing$;
	close;
}

 

Thanks @Capuche it worked!

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...