MorganaSacani
Active Member
- Joined
- Sep 20, 2022
- Messages
- 87
- Solutions
- 1
- Reaction score
- 32
I'm creating a script, but I will have to do a lot of repetitions. For that I need to understand how to create a loop and make my work easier
I thought of something like this, but I don't know how to do it:
I need to add the doTransformItem in the loop too but I don't know how
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- Trees
-- Stones
-- Corpses
if itemEx.itemid == 2813 then -- Dead Rat
if math.random(1, 100) <= 60 then
doPlayerAddItem(cid, 2666, 3) -- Raw Meat
else
doPlayerAddItem(cid, 5878, 1) -- Leather
end
if math.random(1, 100) <= 30 then
doTransformItem(itemEx.uid, 2815)
-- doDecayItem(itemEx.uid)
end
end
return true
end
I thought of something like this, but I don't know how to do it:
Lua:
local TARGETS = {
[2813] = {
[2666] = 3, -- Raw meat
[5878] = 1, -- Leather
}
}
I need to add the doTransformItem in the loop too but I don't know how