X
Xikini
Guest
Server version is irrelevant for this question. 
I am trying to implement a 'chance to win' within my table, so I can easily change the chance of getting an item, depending on how many different items there are to win, however, for some reason the 'local number' is requiring an end, and I don't understand why that is.
Can someone explain where the end is supposed to go?
Thanks.

I am trying to implement a 'chance to win' within my table, so I can easily change the chance of getting an item, depending on how many different items there are to win, however, for some reason the 'local number' is requiring an end, and I don't understand why that is.
Can someone explain where the end is supposed to go?
Thanks.

Code:
local prizes = {
[1] = {min = 1, max = 10, item_id = 1111, amount = 1}, -- 10 percent chance
[2] = {min = 11, max = 40, item_id = 1111, amount = 1}, -- 30 percent chance
[3] = {min = 41, max = 100, item_id = 1111, amount = 1} -- 60 percent chance
}
function onUse(cid, item, frompos, item2, topos)
local number = (math.random(1,100)
for i = 1, #prizes do -- #prizes.min, #prizes.max
if number >= prizes[i].min and number <= prizes[i].max then
doPlayerAddItem(cid, prize[i].item_id, prize[i].amount)
break
end
end
return true
end