• 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!

CreatureEvent Promotion_OnAdvance [worth to see it]

ermm.. i think that has nothing to do with the adv script
 
it wont work =(
PHP:
[19/03/2010 10:42:13] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/changepvp.lua:18: '}' expected (to close '{' at line 11) near 'Storage'
[19/03/2010 10:42:13] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/changepvp.lua)
[19/03/2010 10:42:13] data/creaturescripts/scripts/changepvp.lua:18: '}' expected (to close '{' at line 11) near 'Storage'

Here is the fix, the error was a comma missing which tricked the server to think the config was suppose to close earlier than it should.

FIX:
Lua:
  --[[    
         Promotion_OnAdvance
        |-------------------|
        (> Author: Cybermaster
        (> Revision: Shawak, Znote
        (> Scripted in: TFS 0.3.6pl1
--]]

function onAdvance(cid, skill, oldLevel, newLevel)

local _SETUP = {
        level = 30,                             --level where the player will obtain the promotion when he reaches it
        type = MESSAGE_STATUS_CONSOLE_ORANGE,   --the message class
        text = "You have just been promoted to " .. getPlayerVocationName(cid) .."!",
                effect = 37,                             --the effect for the leveling up animation
                premmy = true,                        --requires premium account?
                -- This part of config is created by Znote --
                Storage = 1234, -- Anti repeat system. Make sure to use a value that is not already in use.
                textIfAlreadyPromoted = "Since you are already promoted, you will get this reward instead!", -- If he manages to buy promotion before reaching level, he will get an award instead!
        itemIdAP = 2160, -- If already promoted, what itemID should reward be instead?
                ItemCountAP = 5, -- In case itemIdAP is stackable, how many counts? eg itemIdAP 2160 ItemCountAP 5 = 5 crystal coins. 
                promotion = 1  -- promotion level, default = 1 . Ignore if you don't have new vocations. <<Taken from slawkens version>>
                -- End of Znotes config --
}

        if skill == SKILL__LEVEL and newLevel < _SETUP.level then
                return true
        end

        if getPlayerPromotionLevel(cid) ~= 0 or _SETUP.premmy == true and not isPremium(cid) then
                return true
        end

        local p = getPlayerPosition(cid)

        local positions = {
                { pos= {x=p.x+1,y=p.y,z=p.z}, delay = 100, delay2 = 900},
                { pos= {x=p.x+1,y=p.y+1,z=p.z}, delay = 200, delay2 = 980},
                { pos= {x=p.x,y=p.y+1,z=p.z}, delay = 300, delay2 = 1060},
                { pos= {x=p.x-1,y=p.y+1,z=p.z}, delay = 400, delay2 = 1140},
                { pos= {x=p.x-1,y=p.y,z=p.z}, delay = 500, delay2 = 1220},
                { pos= {x=p.x-1,y=p.y-1,z=p.z}, delay = 600, delay2 = 1300},
                { pos= {x=p.x,y=p.y-1,z=p.z}, delay = 700, delay2 = 1380},
                { pos= {x=p.x+1,y=p.y-1,z=p.z}, delay = 800, delay2 = 1460}
        }

        for i = 1, 8 do
                addEvent(doSendDistanceShoot, positions[i].delay, positions[i].pos, p, _SETUP.effect)
                addEvent(doSendDistanceShoot, positions[i].delay2, positions[i].pos, p, _SETUP.effect)
        end

        AntiRepeat = getPlayerStorageValue(cid,Storage)
                if AntiRepeat >= 1 then
                        doPlayerSendCancel(cid, "You have already archived this level on your character before.")
                else
                        if(getPlayerPromotionLevel(cid) >= _SETUP.promotion) then
                                setPlayerStorageValue(cid,Storage,1)
                                doPlayerSendTextMessage(cid, _SETUP.type, _SETUP.textIfAlreadyPromoted)
                                doPlayerAddItem(cid,_SETUP.itemIdAP,_SETUP.ItemCountAP)
                                doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
                                addEvent(doSendMagicEffect, 900, p, 49)
                                doPlayerSave(cid, true)
                        else
                
                                addEvent(doSendMagicEffect, 900, p, 49)
                                setPlayerPromotionLevel(cid, 1)
                                doPlayerSendTextMessage(cid, _SETUP.type, _SETUP.text)
                                doSendAnimatedText(p, "Promoted!", math.random(1,255))
                                doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
                                doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
                                doPlayerSave(cid, true)
                        return true
                        end
                end
        end

If it still does not work, change this in config:
Lua:
                promotion = 1
to
Lua:
                promotion = 1,

And it should work.
 
Back
Top