Addons on level Tfs 0.4

Yaboihunna

Member
Joined
Mar 27, 2019
Messages
59
Reaction score
1
Anyone have a script to get addons on level advance example
Level 10 citizen
Level 20 hunter
Level 30 knight
 

Mustafa1337

Î Àm ŁĕğẹňĎ
Joined
Mar 4, 2017
Messages
313
Reaction score
79
It is already posted try this one
data\creaturescripts\creaturescripts.xml
XML:
<event type="advance" name="AddonsLevel" event="script" value="level.lua"/>
data\creaturescripts\scripts\AddonsLevel.lua
Lua:
local t = {
--    [storage], level, outfit, addons
    [1234] = {135, 136, 3} --citizen
}
function onAdvance(cid, skill, oldLevel, newLevel)
    if skill == SKILL__LEVEL then
        for storage, lalala in pairs(t) do
            if newLevel >= lalala[1] and getPlayerStorageValue(cid, storage) < 1 then
                doPlayerAddOutfit(cid, lalala[2], lalala[3])
                setPlayerStorageValue(cid, storage, 1)
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "CONGRATULATIONS! You've reached level " .. lalala[1] .. ".")
                break
            end
        end
    end
    return true
end
1234 is the storage/135 is the level/136 is outfit number/3 outfit addons

data\creaturescripts\scripts\login.lua
add this
Lua:
    registerCreatureEvent(cid, "AddonsLevel")
I think you have to make one for every addon, I am not sure if it can be done all addons in 1 script.
 

Sttorm

New Member
Joined
Apr 25, 2019
Messages
4
Reaction score
2
@Yaboihunna
Lua:
local t = {
              -- [level] = addon_id
    [10] = 1,
    [20] = 2,
    [30] = 3
}

function onAdvance(cid, skill, oldLevel, newLevel)
    if skill == SKILL__LEVEL and oldLevel < newLevel then
        local x = t[newLevel]
        if x then
            doPlayerAddAddons(cid, x)
            doPlayerSendTextMessage(cid, 27, "You gained an addon by leveling up!!")
            doSendMagicEffect(getCreaturePosition(cid), 5)
        end
    end
    return true
end
 
Top