Cosmotonio
New Member
- Joined
- Nov 26, 2007
- Messages
- 142
- Reaction score
- 0
Code to get precious stones from rock.
It is the new pick.lua file.
Please tell me how to improve my code.
It is the new pick.lua file.
Code:
function getStone(cid, toPosition)
random_number = math.random(1,100)
doSendMagicEffect(toPosition,3)
if random_number>=95 then
doCreateItem(2157, 1, toPosition)
elseif random_number<=94 and random_number>89 then
doCreateItem(1294, 1, toPosition)
elseif random_number<=88 and random_number>83 then
doCreateItem(1293, 1, toPosition)
elseif random_number<=82 and random_number>77 then
doCreateItem(1295, 1, toPosition)
end
end
rocha = {386, 387, 390, 391}
function onUse(cid, item, frompos, itemEx, toPosition)
if isInArray(rocha, itemEx.itemid) == TRUE then
getStone(cid, toPosition)
elseif (itemEx.uid > 0 or itemEx.actionid > 0) and (itemEx.itemid == 354 or itemEx.itemid == 355) then
doTransformItem(itemEx.uid, 392)
doDecayItem(itemEx.uid)
doSendMagicEffect(toPosition, CONST_ME_POFF)
return TRUE
else
return 0
end
return 1
end
Please tell me how to improve my code.