• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

TFS 1.0 onAdvance error.

narko

vertrauenswürdig ~
Joined
Oct 19, 2008
Messages
1,317
Solutions
2
Reaction score
132
Location
Unknown
I can't get this script works in the newest TFS 1.0 (10.37). I've been reading that the funcion newLevel has been replaced with skill == 8 and I also tried but it didn't work.

Code:
function onAdvance(cid, skill, oldlevel, newlevel)
         

            if(getPlayerStorageValue(cid, 89966) ~= 1 and skill == 8 and oldlevel < 100 and player:getLevel() >= 100 then
                    doPlayerAddMount(cid, 24)
                            setPlayerStorageValue(cid, 89966, 1)
                            doPlayerSendTextMessage(cid, 22, "You have received a new mount!")
                            doCreatureSay(cid, "New mount!", TALKTYPE_ORANGE_1)
                            end

            if(getPlayerStorageValue(cid, 89967) ~= 1 and skill == 8 and oldlevel < 200 and player:getLevel() >= 200 then
                            doPlayerAddItem(cid, 2160, 20)
                            doPlayerAddMount(cid, 38)
                            setPlayerStorageValue(cid, 89967, 1)
                            doPlayerSendTextMessage(cid, 22, "You have recieved 20 crystal coins and a new mount!")
                            doCreatureSay(cid, "New mount!", TALKTYPE_ORANGE_1)
                            end

   
            if(getPlayerStorageValue(cid, 89968) ~= 1 and skill == 8 and oldlevel < 250 and player:getLevel() >= 250 then
                            doPlayerAddItem(cid, 9693, 1)
                            doPlayerAddMount(cid, 9)
                            setPlayerStorageValue(cid, 89968, 1)
                            doPlayerSendTextMessage(cid, 22, "You have recieved an addon doll and a new mount!")
                            doCreatureSay(cid, "New mount!", TALKTYPE_ORANGE_1)
                            end

if(getPlayerStorageValue(cid, 89969) ~= 1 and skill == 8 and oldlevel < 300 and player:getLevel() >= 300 then
                            doPlayerAddItem(cid, 16101, 1)
                            doPlayerAddMount(cid, 33)
                            setPlayerStorageValue(cid, 89969, 1)
                            doPlayerSendTextMessage(cid, 22, "You have recieved points scroll and a new mount!")
                            doCreatureSay(cid, "New mount!", TALKTYPE_ORANGE_1)
                            end





            return TRUE
end
 
yes there is but you need to think a little bit :P btw why are you using this
player:getLevel()

while the player variable is not set anywhere in the script that is the basic of basics of scripting, you copied this script from the one at printers datapack but didn't copied it right :/
 
Code:
-- by andu for narko

local storage = 89966 -- storages reserved from X to X + amount of things in config (already 4)
local config = {
    [1] = {level = 100, mount = 24, gold = 0, items = {}},
    [2] = {level = 200, mount = 28, gold = 20000, items = {}},
    [3] = {level = 250, mount = 9, gold = 0, items = {9693}},
    [4] = {level = 300, mount = 33, gold = 0, items = {16101}}
}

function onAdvance(cid, skill, oldlevel, newlevel)
    if skill == 8 or skill == SKILL__LEVEL then
        for i = 1, #config do
            local text = "You have received:"
            if newlevel == config[i].level and (getPlayerStorageValue(cid, storage + (i - 1)) ~= nil and -1) then
                if config[i].gold ~= 0 then
                    doPlayerAddGold(cid, config[i].gold)
                    text = " " ..config[i].gold.. " gold"
                end
                if #config[i].items > 0 then
                    if config[i].gold ~= 0 then
                        text = text.. ","
                    end
                    for j = 1, #config[i].items do
                        doPlayerAddItem(cid, config[i].items[j], 1)
                        text = text.. " " ..getItemPluralNameById(config[i].items[j]).. " " ..getItemNameById(config[i].items[j])
                        if j ~= #config[i].items then
                            items = items.. ","
                        end
                    end
                end
                if config[i].mount ~= 0 then
                    if config[i].gold ~= 0 or #config[i].items ~= 0 then
                        text = text.. ","
                    end
                    doCreatureSay(cid, "New mount!", TALKTYPE_ORANGE_1)
                    doPlayerAddMount(cid, config[i].mount)
                    text = text.. " and a new mount"
                end
                doPlayerSetStorageValue(cid, storage + (i - 1), 1)
                doPlayerSendTextMessage(cid, 22, text.. "!")
            end
        end
    end
    return true
end
 
Back
Top