LucasFerraz
Systems Analyst
You will need this lib of Achievements: http://otland.net/f81/achievements-lib-talkaction-122039/
You also can check my http://otland.net/f81/achievements-pack-132764/
Lotery Ticket
You also can check my http://otland.net/f81/achievements-pack-132764/
Lotery Ticket
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\".")
doPlayerAddAchievement(cid, 26)
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