Jump to content
  • 0

Arrays on countitem


Radian

Question


  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.05
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  

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

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 1

  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.05
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  

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!

Link to comment
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.   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.

×
×
  • Create New...