Jump to content
  • 0
ѕeмa™

problem with array

Question

Hi, i have 1 problem with one array, i'm creating one system but i need make a number in the array.

 

Example:

		itemsalchemie = {
			--- round 1
			[0] = { -- number of round
				[0] = {1130, 1}, -- [0] = number of item, vnum and ammount
				[1] = {1131, 1},
				[2] = {1132, 1},
				[3] = {1133, 1},
				[4] = {1134, 1},
				[5] = {1135, 1},
				[6] = {1136, 1},
				[7] = {1137, 1}
			},
			--- round 2
			[1] = {
				[0] = {1130, 1},
				[1] = {1131, 1},
				[2] = {1132, 1},
				[3] = {1133, 1},
				[4] = {1134, 1},
				[5] = {1135, 1},
				[6] = {1136, 1},
				[7] = {1137, 1}
			}
		}
		
		local ran = number(1, table.getn(itemsalchemie[0])) --- this use a number in the round 1?
		
		local ran = number(1, table.getn(itemsalchemie[1])) --- this use a number in the round 2?
				
		

I need put a number or math.ramdom in the locan ran but, in the round selected

 

Thanks.

Share this post


Link to post

4 answers to this question

Recommended Posts

  • 0

And if i need put a syschat to show the dates?

 

 

sychat("itemsalchemie[0][ran][1].." "..itemsalchemie[0][ran][2].." "..itemsalchemie[0][ran][3].." "..itemsalcheme[0][ran][4]) <--- this is ok?

 

 

sorry my bad english.

Share this post


Link to post
  • 0

And if i need put a syschat to show the dates?

 

 

sychat("itemsalchemie[0][ran][1].." "..itemsalchemie[0][ran][2].." "..itemsalchemie[0][ran][3].." "..itemsalcheme[0][ran][4]) <--- this is ok?

 

 

sorry my bad english.

itemsalchemie[0][ran][1]

will return the amount you specified at the top of a random item from table one.. the other give empty table error. if you want to return the whole table:

 

local output = ""
for i = 0, table.getn(itemsalchemie[0]), 1 do
output = output..itemsalchemie[0][i].." "
end

syschat(output)
  • Love 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.