LucasFerraz
Systems Analyst
XML:
<action itemid="5957" event="script" value="loteryticket.lua"/>
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid,21026) == 500 then
doPlayerSendTextMessage(cid,22,"Congratulations! You earned the achievement \"Jinx\".")
setPlayerStorageValue(cid, 20026)
end
local rand = math.random(0, 10)
local lotteryid = 5957
if item.itemid == lotteryid then
if rand < 1 then
doCreatureSay(cid, "You have a winning lottery ticket!", TALKTYPE_ORANGE_1)
doTransformItem(item.uid, item.itemid + 1)
setPlayerStorageValue(cid, 21026, getCreatureStorage(cid, 21026) + 1)
doSendMagicEffect(fromPosition,12)
elseif rand > 2 then
doCreatureSay(cid, "Sorry, This is not a winning lottery ticket.", TALKTYPE_ORANGE_1)
doTransformItem(item.uid, item.itemid - 1)
setPlayerStorageValue(cid, 21026, getCreatureStorage(cid, 21026) + 1)
end
end
return TRUE
end
-------------------------
repp++