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

Reward on x level???

nystrom

New Member
Joined
Nov 17, 2009
Messages
269
Reaction score
0
Hello i have been looking for a script that makes my players get money when they advances to a special level, but i cant get any of the ones on the forum to work on my server...
if this is to any help so am i using TFS 0.3.6

this is my current script:

PHP:
local config = {
                levelReach = 35,
                item = 2160,
                count = 1
                }
 
function onAdvance(cid, skill, oldLevel, newLevel)
 
if(skill == SKILL__LEVEL and newLevel >= config.levelReach and getPlayerStorageValue(cid, 100000) == -1) then
        setPlayerStorageValue(cid, 100000, 1)
        doPlayerAddItem(cid, config.item, config.count)
end
 
return TRUE
end

it is located in: data\creaturescripts\scripts\reward.xml

and i have registrated it in: data\creaturescripts.xml with this line:
PHP:
<event type="advance" name="reward" event="script" value="reward.lua"/>

please can some one help me get this to work? (A)
 
I'm not very good dealing with creaturescripts, but could it be possible that you need to have it registered in login.lua as well?
 
Anything functional for 0.4?
Code:
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
 
Back
Top