ziggy46802
Active Member
- Joined
- Aug 19, 2012
- Messages
- 418
- Reaction score
- 27
Here is my script
Now why does the random time work but my pick never breaks, I can spam mining for 20 times and it wont break but its 100% chance to break, it dont make sense!
Code:
unction onUse(cid, item, frompos, item2, topos)
bigrock = 8634
smallrock = 8638
rock = 4001
posa = {x=1094,y=1060,z=6}
object = getThingFromPos(posa)
rand = math.random(0,10000)
rando = math.random(1,2)
function goto(cid)
addEvent(restore, rand,rand , cid) --in 1 to 5 seconds go to "restore"
if rando >= 1 then
doRemoveItem(cid, 2553)
doCreatureSay(cid, "Uh oh, your pick broke!", TALKTYPE_ORANGE_1) --5% pick breaks
return false
end
return true
end
function restore(cid, item1, item2)
doRemoveItem(getTileItemById(posa, smallrock).uid) --remove smallrock
doCreateItem(bigrock,posa) --create bigrock PROBLEM
doSetItemActionId(getTileItemById(posa, bigrock).uid, 4001)
return true
end
if item.itemid == bigrock and getPlayerItemCount(cid,2553) >= 1 and getPlayerSkill(cid, SKILL_FIST) >= 1
then
doPlayerAddSkillTry(cid, SKILL_FIST, 10)
doRemoveItem(getTileItemById(posa, bigrock).uid)
doCreateItem(smallrock,posa)
addEvent(goto, 1, 5, cid) --jump to "goto"
doSendMagicEffect(getPlayerPosition(cid), 13) --send magic effect
doCreatureSay(cid, "You mined it!", TALKTYPE_ORANGE_1) --say "You mined it!"
return true
end
return true
end
Now why does the random time work but my pick never breaks, I can spam mining for 20 times and it wont break but its 100% chance to break, it dont make sense!
Last edited: