- Joined
- Sep 7, 2015
- Messages
- 2,735
- Solutions
- 127
- Reaction score
- 2,203
I have this code, im not good at lua...
Every lua master should get the concept.
So can someone help me?
Item ids: 2554 = shovel
Action id: 22543 = tile action id
TFS 1.2
Every lua master should get the concept.
So can someone help me?
Item ids: 2554 = shovel
Action id: 22543 = tile action id
TFS 1.2
Code:
local config = {
mud = {22543}
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 2554 and isInArray(config.mud, target.actionid) and (math.random(1,40) <= 1) then
player:addItem(20138, 1)
doCreatureSay(cid, "You dug up a Leech!", MESSAGE_EVENT_ADVANCE)
return true
elseif(isInArray(config.mud, target.actionid)) and (math.random(7,10) <= 7) then
player:addItem(2817, 1)
doCreatureSay(cid, "Again dead snake?! Again? I guess I'll have to dig more!", MESSAGE_EVENT_ADVANCE)
return true
elseif(isInArray(config.mud, target.actionid)) and (math.random(2,10) <= 2) then
player:addItem(2145, 1)
doCreatureSay(cid, "You Found a Small Diamond!", MESSAGE_EVENT_ADVANCE)
return true
end
return true
end