Jump to content

Recommended Posts

local itens = 
{
{50615, 1},{50616, 1},{50617, 1},{31062, 1},{27993, 4},{27992, 4},{27994, 4},
{53022, 1},{71018, 1},{71019, 1},{71020, 1},{30183, 1},{30319, 1},{72703, 1},
{72704, 1},{72706, 1},{72705, 1},{71035, 1},{71102, 5},{27874, 5}
}
 
pc.give_item2(itens[math.random(1,20)][1], itens[1][2])

example : {27874, 5} was to leave 5 units in this case

 

but leaves only one and do not know what's wrong can someone help me?

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

local items = 
{
	{50615, 1},{50616, 1},{50617, 1},{31062, 1},{27993, 4},{27992, 4},{27994, 4},
	{53022, 1},{71018, 1},{71019, 1},{71020, 1},{30183, 1},{30319, 1},{72703, 1},
	{72704, 1},{72706, 1},{72705, 1},{71035, 1},{71102, 5},{27874, 5}
}
local entry = math.random(1,table.getn(items))
pc.give_item2(items[entry][1],items[entry][2])

I didn't understood very well what you wrote so I guess that's what you want.

Link to comment
Share on other sites

He said that {item_id, count} doesn't work in his table.

 

Solution is easy.

local index =
            {   [1] = {1111, 5},
                [2] = {2222, 4},
                [3] = {3333, 3},
            }
 
local idx = index[1]
syschat("Item ID: ".. idx[1])
syschat("Count: "..idx[2])
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.