T
Tairens
Guest
System Gornictwo i chyba nic wi?cej t?umaczy? nie musz?
Doklejcie sobie do kodu moj? bibliotek? z tematu:
http://tibia.net.pl/showthread.php?p=947649#post947649
Tutaj kod:
Doklejcie sobie do kodu moj? bibliotek? z tematu:
http://tibia.net.pl/showthread.php?p=947649#post947649
Tutaj kod:
Code:
local config =
{
exhaustion = , --Exhaustion storage
skillTries = , --Skill Tries storage
skill = , --Skill storage
minerals = {}, --Minerals for digging
exhaustionTime = , --Exhaustion time in milisecunds
reward = , --Reward
skillRate = --Skill rate
}
function onUse(cid, item, fromPos, itemEx, toPos)
local chances, text = math.random(1, 3), "Nothing."
Gornictwo = System.create(cid, config.skill, config.skillTries)
Gornictwo:setTypes({0, 1, 2})
Gornictwo:setSkillRate(config.skillRate)
if(isInArray(config.minerals, itemEx.itemid) == false) then
return false
end
if (exhaustion.check(cid, config.exhaustion) == true) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, 'You are exhuasted.')
return true
end
Gornictwo:setTryType(chances)
if (math.floor(math.random(1, 9000) / Gornictwo:getSkill()) < 100) then
doPlayerAddItem(cid, config.reward)
text = "You have found "..getItemNameById(config.reward).."."
end
if (Gornictwo:calculateSkill() == true) then
doCreatureSay(cid, "Level up!")
end
Gornictwo:Save()
exhaustion.set(cid, config.exhaustion, config.exhaustionTime)
doPlayerSendTextMessage(cid, 22, text)
return true
end
Code:
<action itemid="id_itemu_" event="script" value="Gornictwo.lua"/>