Hello guys!
I need some help with this script, is it possible to make it in percentage chance of getting certain items?
Like:
30% to get itemid xxxx
10% to get itemid xxxx
and so on.
I need some help with this script, is it possible to make it in percentage chance of getting certain items?
Like:
30% to get itemid xxxx
10% to get itemid xxxx
and so on.
Code:
local items = {9969, 9932, 7735, 22409, 22415, 22403, 2352, 21696, 22424, 21707, 21706, 21692, 21725}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local random = math.random(1, #items)
local name = getItemName(items[random])
doPlayerAddItem(cid, donations[random])
doCreatureSay(cid, "Congratz. Enjoy your "..name, TALKTYPE_ORANGE_1)
doSendMagicEffect(getPlayerPosition(cid), 27)
doRemoveItem(item.uid)
end