elnelson
Lunaria World Dev
Hello, otlanders. I have this script but when player doesnt have enough soul it spams the message several times.
17:32 You need more soul.
17:32 You need more soul.
17:32 You need more soul.
17:32 You need more soul.
17:32 You need more soul.
17:32 You need more soul.
How can i fix that annoying bug?
here is the script
17:32 You need more soul.
17:32 You need more soul.
17:32 You need more soul.
17:32 You need more soul.
17:32 You need more soul.
17:32 You need more soul.
How can i fix that annoying bug?
here is the script
Lua:
local cfg = {
soul = 5,
level = 1
}
local t = {
[{4006}] = {fruit = 2675, NFTree = 4008, amount = 3, fName = "oranges"},
[{5094}] = {fruit = 2676, NFTree = 5093, amount = 3, fName = "bananas"},
[{5096}] = {fruit = 2678, NFTree = 2726, amount = 3, fName = "coconuts"},
[{5157}] = {fruit = 5097, NFTree = 5156, amount = 3, fName = "mangoes"},
[{2785}] = {fruit = 2677, NFTree = 2786, amount = 3, fName = "blueberries"},
[{4012}] = {fruit = 2684, NFTree = 6218, amount = 3, fName = "carrots"}
}
function onUse(cid, item, frompos, item2, topos)
local S = getPlayerSoul(cid)
local L = getPlayerLevel(cid)
for i, k in pairs(t) do
if (isInArray(i, item.itemid) == true) and (S >= cfg.soul) and (L >= cfg.level) then
doTransformItem(item.uid, k.NFTree)
doPlayerAddItem(cid, k.fruit, k.amount)
doPlayerAddSoul(cid, -cfg.soul)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got some "..k.fName..".")
elseif (S < cfg.soul) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need more soul.")
elseif (L < cfg.level) then
doPlayerSendCancel(cid, "You need more level.")
end
end
end