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

Reward when get x level TFS 0.3.7

armyman

Member
Joined
Feb 15, 2014
Messages
318
Reaction score
14
anyone have script for reward platinum coins when get new level?

Example

Level 8 = reward
Level 15 = reward
Level 20 = reward
Level 30 = reward
 
LUA:
local c = {
   [{1,5}] = { -- sorcerer
     [50] = {items = {{itemid = 2160, count = 5}}, storage = 40953},
     [100] = {items = {{itemid = 2160, count = 10}}, storage = 40954},
     [200] = {items = {{itemid = 2160, count = 20}}, storage = 40955}
   },
   [{2,6}] = { -- druid
     [50] = {items = {{itemid = 2160, count = 5}}, storage = 40953},
     [100] = {items = {{itemid = 2160, count = 10}}, storage = 40954},
     [200] = {items = {{itemid = 2160, count = 20}}, storage = 40955}
   },
   [{3,7}] = { -- paladin
     [50] = {items = {{itemid = 2160, count = 5}}, storage = 40953},
     [100] = {items = {{itemid = 2160, count = 10}}, storage = 40954},
     [200] = {items = {{itemid = 2160, count = 20}}, storage = 40955}
   },
   [{4,8}] = { -- knight
     [50] = {items = {{itemid = 2160, count = 5}}, storage = 40953},
     [100] = {items = {{itemid = 2160, count = 10}}, storage = 40954},
     [200] = {items = {{itemid = 2160, count = 20}}, storage = 40955}
   }
}
function onAdvance(cid, skill, oldlevel, newlevel)
         if skill ~= SKILL__LEVEL then
             return true
         end
         for voc, x in pairs(c) do
             if isInArray(voc, getPlayerVocation(cid)) then
                     for level, z in pairs(x) do
                         if newlevel >= level and getPlayerStorageValue(cid, z.storage) ~= 1 then
                    local text = ""
                    for v = 1, #z.items do
                        count, info = z.items[v].count, getItemInfo(z.items[v].itemid)
                        local ret = ", "
                        if v == 1 then
                            ret = ""
                        elseif v == #z.items then
                            ret = " and "
                        end
                        text = text .. ret
                        text = text .. (count > 1 and count or info.article).." "..(count > 1 and info.plural or info.name)
                        doPlayerAddItem(cid, z.items[v].itemid, z.items[v].count)
                    end
                                 doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations, you reached level "..level.." and received "..text..".")
                                 doSendMagicEffect(getPlayerPosition(cid), CONST_ME_FIREWORK_YELLOW)
                                 setPlayerStorageValue(cid, z.storage, 1)
                         end
                     end
             end
         end
         return true
end

Took from : Reward on x level??? last reply.
Msg me if you need help configuring the script.
 
Back
Top