marcryzius
New Member
- Joined
- Mar 22, 2009
- Messages
- 61
- Reaction score
- 0
this is a simples script to job woocutter
script exclusive to otland
Lua:
--[[> Marcryzius D'evil <]]--
function onUse(cid, item, fromPosition, itemEx, toPosition)
local arvores = {2701,2702,2703,2704,2705,2706,2707,2708,2709,2710,2712,2717,2718,2720,2722} --id of tree
local function skill(cid)
local skills = getPlayerStorageValue(cid,101)
if skills < 0 then
skills = 0
end
return skills
end
local function level(cid)
local levels = getPlayerStorageValue(cid,201)
if levels < 0 then
levels = 0
end
return levels
end
local number = math.random(1,400)
if getPlayerStorageValue(cid,991) == 1 then -- store for use this job
if isInArray(arvores, itemEx.itemid) == TRUE then
if level(cid)*2 > skill(cid) then
if number <= level(cid) then
if skill(cid) > 10 then
doSendMagicEffect(toPosition,14)
doPlayerAddItem(cid,5901,1)
doTransformItem(itemEx.uid,6431)
-- add in config.lua variable criarArvore for create tree use 'yes'
if(getConfigInfo('criarArvore') == 'yes')then
addEvent(function(pos,item)
local item = getThingFromPos(pos)
doSendMagicEffect(pos,34)
doSendMagicEffect(pos,45)
doTransformItem(item.uid,item)
end,60*1000*math.random(10,30),toPosition,itemEx.itemid)
end
setPlayerStorageValue(cid,101,-1)
else
doSendMagicEffect(toPosition,3)
setPlayerStorageValue(cid,101,skill(cid)+1)
end
else
doSendMagicEffect(toPosition,3)
setPlayerStorageValue(cid,101,skill(cid)+1)
end
else
setPlayerStorageValue(cid,201,level(cid)+1)
doSendMagicEffect(toPosition,3)
doPlayerSendTextMessage(cid, 20,"you advance to "..level(cid).." in profission (woodcutter).")
setPlayerStorageValue(cid,101,0)
end
else
doPlayerSendCancel(cid,"you can not use the axe on that tree.")
end
else
doSendMagicEffect(toPosition,3)
end
return TRUE
end
script exclusive to otland