jestemPolakiem
New Member
Present
by jestemPolakiem
by jestemPolakiem
script has been tested on The Forgotten Server 0.3.6pl1 and worked
Code:
[B]To use the script, just use a present.[/B]
I congratulate you won item! This item is ITEMNAME!
Sorry, have not won anything!
data/actions/actions.xml
PHP:
<action itemid="9074" event="script" value="9074.lua"/>
data/actions/scripts/9074.xml
PHP:
items = {
[0] = {id = 2472, count = 1, chance = 2},
[1] = {id = 2466, count = 1, chance = 5},
[2] = {id = 8930, count = 1, chance = 10},
[3] = {id = 8858, count = 1, chance = 15},
[4] = {id = 2160, count = 10, chance = 30},
[5] = {id = 6569, count = 50, chance = 100}
}
function onUse(cid, item, fromPos, itemEx, toPos)
for i = 0, #items do
if (items[i].chance > math.random(1, 100)) then
doPlayerAddItem(cid, items[i].id, items[i].count)
doRemoveItem(item.uid, 1)
return doCreatureSay(cid, 'I congratulate you won item! This item is '..getItemNameById(items[i].id)..'!', TALKTYPE_MONSTER)
end
end
doRemoveItem(item.uid, 1)
return doCreatureSay(cid, 'Sorry, have not won anything!', TALKTYPE_MONSTER)
end
Greets
jestemPolakiem