• Vote in May Mapping Competition to select a winner!
  • 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!

Addons on level Tfs 0.4

Yaboihunna

New Member
Joined
Mar 27, 2019
Messages
131
Best answers
0
Reaction score
3
Anyone have a script to get addons on level advance example
Level 10 citizen
Level 20 hunter
Level 30 knight
 

M0ustafa

1337
Support Team
Joined
Mar 4, 2017
Messages
1,587
Best answers
192
Reaction score
598
Location
Egypt
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
Best answers
0
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