Saints Anathema
Old School Doleran
Code:
function onUse(cid, item, frompos, item2, topos)
local config = {
SkillStorage = 1001,
MineStorage = 1000,
Level = 50,
ActionID = 2000,
GetSkill = getPlayerStorageValue(cid, config.SkillStorage),
AdvanceSkillChance = math.random(1, 2),
MoneyChance = math.random(1, 50),
PlatinumCount = math.random(1, 50), -- 1 To 50 Platinum can be awarded.
CrystalCount = math.random(1, 5), -- 1 To 5 Crystal can be awarded.
MonsterChance = math.random(1, 15),
StrongBreakChance = math.random(1, 25),
NormalBreakChance = math.random(1, 10),
monsters = {"Dwarf", "Hydra", "Demon"}
}
if getPlayerLevel(cid) >= config.Level and item.actionid == config.ActionID then
if config.AdvanceSkillChance == 1 then
setPlayerStorageValue(cid, config.SkillStorage, config.GetSkill + 1)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_BIGCLOUDS)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You now have ".. getPlayerStorageValue(cid, config.SkillStorage)" mining Skill.")
elseif config.MoneyChance == 15 or config.MoneyChance == 30 then
doPlayerAddItem(cid, 2152, config.PlatinumCount)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_CAKE)
elseif config.MoneyChance == 5 or config.MoneyChance == 18 then
doPlayerAddItem(cid, 2160, config.CrystalCount)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_YALAHARIGHOST)
elseif config.MonsterChance == 3 or config.MonsterChance == 15 then
doSummonCreature(config.monsters[math.random(1, #config.monsters)], getCreaturePosition(cid))
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_BIGCLOUDS)
elseif config.StrongBreakChance == 5 or config.StrongBreakChance == 15 and getPlayerStorageValue(cid, config.SkillStorage) >= 50 then
doDecayItem(itemEx.uid)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
elseif config.NormalBreakChance <= 2 or config.NormalBreakChance >= 7 and getPlayerStorageValue(cid, config.SkillStorage) <= 50 then
doDecayItem(itemEx.uid)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
else
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You do not have high enouph Level.")
end
end
return TRUE
end
Code:
Lua Script Error: [Action Interface]
data/actions/scripts/tools/mining.lua:onUse
data/actions/scripts/tools/mining.lua:7: attempt to index global 'config' (a nil
value)
stack traceback:
data/actions/scripts/tools/mining.lua:7: in function <data/actions/scrip
ts/tools/mining.lua:1>
REP+ to any help or posts
Original Credits go to Sync
my server is tfs 0.2.4