I have made a simple mining script which works, except for removing the item, the item does get removed if the player has it on them or in their bp but if the item is on the floor it can be used forever without being removed, please could someone show me where i've gone wrong as i would love to use this feature.
I'm running 0.3.6 and here is the script:
I'm running 0.3.6 and here is the script:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
randomNumber = math.random(1, 100)
if itemEx.itemid == 1285 then
if randomNumber >= 75 then
doPlayerAddItem(cid, 2157, math.random(5, 10))
doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
elseif randomNumber >= 50 and randomNumber < 75 then
doPlayerAddItem(cid, 2160, math.random(25, 50))
doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
elseif randomNumber >= 25 and randomNumber < 50 then
doPlayerAddItem(cid, 6527, math.random(1, 5))
doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
elseif randomNumber < 25 then
doPlayerRemoveItem(cid, item.itemid, 1)
doSendMagicEffect(fromPosition, CONST_ME_POFF)
else
doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
end
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You can\'t mine this.')
end
return true
end