• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua [Action] Help me plz

11997733

New Member
Joined
Feb 10, 2009
Messages
25
Reaction score
1
My Script that needs Fixed -Thanks-

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:
Code:
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[COLOR="#FF0000"]}[/COLOR]] = 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

try
 
FIXED IT GUYS

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
 
NEW ERROR HAHA
Lua:
[27/11/2011 12:48:28] Lua Script Error: [Action Interface] 
[27/11/2011 12:48:28] data/actions/scripts/tools/candy cane.lua:onUse
[27/11/2011 12:48:28] luaDoSendAnimatedText(). Deprecated function.
[27/11/2011 12:48:28] stack traceback:
[27/11/2011 12:48:28] 	[C]: in function 'doSendAnimatedText'
[27/11/2011 12:48:28] 	data/actions/scripts/tools/candy cane.lua:59: in function <data/actions/scripts/tools/candy cane.lua:20>
 
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
 
           
            doSendMagicEffect(positions[i],effect)
        end
    end
    return TRUE 
end

doSendAnimatedText IS NOT USED IN VERIONS 9.1+
 
Back
Top