Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local rewards = {
- premios = {
- [1] = {
- items = {
- {itemID = 2160, count = 1},
- {itemID = 2170, count = 1},
- {itemID = 2155, count = 1},
- },
- chance = 80,
- nome = "items",
- },
- [2] = {
- items = {
- {itemID = 2160, count = 50},
- {itemID = 2160, count = 50},
- {itemID = 2160, count = 50},
- },
- chance = 20,
- nome = "addons",
- },
- }
- }
- function onUse(player, item, fromPosition, target, toPosition, isHotkey)
- local random = math.random(100)
- local i = 1
- while (i <= #rewards.premios) do
- local v = rewards.premios[i]
- for i =1, #v.items do
- local spot = v.items[i]
- if (random <= v.chance) then
- if (v.nome == "items") then
- local new_item = player:addItem(spot.itemID, spot.count)
- if (type(new_item) == "table") then
- new_item = new_item[1]
- end
- i = 999
- break
- elseif (v.nome == "addons") then
- local new_item = player:addItem(spot.itemID, spot.count)
- if (type(new_item) == "table") then
- new_item = new_item[1]
- end
- i = 999
- break
- end
- end
- end
- i = i + 1
- random = math.random(100)
- end
- player:sendTextMessage(22,"Clicou")
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement