My Script that needs Fixed -Thanks-
ERROR i get in consol!.
Lua:
local config = {
funnyEffect = "YES",
minimumLevel = 5,
maximumLevel = 15, -- for infinite type math.huge
}
local addExp = {
[{config.minimumLevel, 5}] = 150,
[{5, 6}] = 150,
[{6, 7}] = 175,
[{7, 8] = 200,
[{8, 9}] = 225,
[{9, 10}] = 250,
[{10, 11}] = 275,
[{11, 12}] = 300,
[{12, 13}] = 350,
[{13, 14}] = 400,
[{14, 15}] = 500,
[{15, config.maximumLevel}] = 500
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local level = getPlayerLevel(cid)
local effect = math.random(CONST_ME_FIREWORK_YELLOW,CONST_ME_FIREWORK_BLUE)
if level < config.minimumLevel then
doPlayerSendCancel(cid, "You need to be at least level "..config.minimumLevel.." to eat your christmas Candy's.")
return FALSE
end
if level >= config.maximumLevel then
doPlayerSendCancel(cid, "Your level is too high to eat this type of candy.")
return FALSE
end
for k, v in pairs(addExp) do
if level >= k[1] and level < k[2] then
doPlayerAddExp(cid, v)
doPlayerSendTextMessage(cid, 22, "Merry Christmas You Got " .. v .." experience!")
doRemoveItem(item.uid, 1)
break
end
end
if config.funnyEffect == "YES" then
local playerexp = addExp
local pos = getPlayerPosition(cid)
local positions = {
{x=pos.x+1,y=pos.y-1,z=pos.z},
{x=pos.x-1,y=pos.y-1,z=pos.z},
{x=pos.x+1,y=pos.y+1,z=pos.z},
{x=pos.x-1,y=pos.y+1,z=pos.z},
{x=pos.x+1,y=pos.y,z=pos.z},
{x=pos.x-1,y=pos.y,z=pos.z},
{x=pos.x,y=pos.y+1,z=pos.z},
{x=pos.x,y=pos.y-1,z=pos.z}
}
for i = 1, table.getn(positions) do
doSendAnimatedText(getThingPos(cid), playerexp, TEXTCOLOR_RED)
doSendMagicEffect(positions[i],effect)
end
end
return TRUE
end
ERROR i get in consol!.
Lua:
[27/11/2011 12:32:07] Warning: [Event::checkScript] Can not load script. /scripts/tools/candy cane.lua
[27/11/2011 12:32:07] data/actions/scripts/tools/candy cane.lua:10: '}' expected near ']'
Last edited by a moderator: