Eu fiz pra vc mas o cara vai ter que estar com os nuggets na bp. Nao sei se tem como fazer com os nuggets estando fora...
function onUse(cid, item, itemEx, frompos, topos)
local chance = 50 -- Chance em % de criar a amethyst
if(not itemEx.itemid == 2157) or (getPlayerItemCount(cid, 2157) < 100) then
return doPlayerSendCancel(cid, "Vc precisa ter 100 gold nuggets.")
end
doPlayerRemoveItem(cid, 2157, 100)
local zp = math.random(1, 100)
if zp <= chance and zp > 1 then
doPlayerAddItem(cid, 7762, 1)
doSendAnimatedText(getCreaturePosition(cid), "Sucesso!", 215)
doSendMagicEffect(topos, 30)
else
doSendMagicEffect(topos, CONST_ME_POFF)
doCreatureSay(cid,"Fail!", TALKTYPE_ORANGE_1)
end
return true
end
EDIT: consegui fazer com os nuggets estando no chao
Gracas a um post recente do brun123
function onUse(cid, item, itemEx, frompos, topos)
local chance = 50 -- Chance em % de criar a amethyst
local uid = getTileItemById(topos, 2157).uid
if(not itemEx.itemid == 2157) or uid < 100 then
return doPlayerSendCancel(cid, "Vc precisa ter 100 gold nuggets.")
end
doRemoveItem(uid, 100)
local zp = math.random(1, 100)
if zp <= chance and zp > 1 then
doCreateItem(7762, 1, topos)
doSendAnimatedText(getCreaturePosition(cid), "Sucesso!", 215)
doSendMagicEffect(topos, 30)
else
doSendMagicEffect(topos, CONST_ME_POFF)
doCreatureSay(cid,"Fail!", TALKTYPE_ORANGE_1)
end
return true
end