• 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 Script Not Works

Rider Ones

New Member
Joined
Jan 12, 2009
Messages
104
Reaction score
2
I have this script but not works on my server HELP??
OTX Server 2.51
Tibia 8.60

Code:
local c = {
   [{1,5}] = {
     [20] = {items = {{itemid = 2188, count = 1}}, storage = 99963},
     [30] = {items = {{itemid = 2160, count = 2}}, storage = 99964},
     [45] = {items = {{itemid = 2160, count = 2}}, storage = 99965}
   },
   [{2,6}] = {
     [20] = {items = {{itemid = 2185, count = 1}}, storage = 99963},
     [30] = {items = {{itemid = 2160, count = 2}}, storage = 99964},
     [45] = {items = {{itemid = 2160, count = 2}}, storage = 99965}
   },
   [{3,7}] = {
     [20] = {items = {{itemid = 2160, count = 1}}, storage = 99963},
     [30] = {items = {{itemid = 2160, count = 2}}, storage = 99964},
     [45] = {items = {{itemid = 2160, count = 2}}, storage = 99965}
   },
   [{4,8}] = {
     [20] = {items = {{itemid = 2160, count = 1}}, storage = 99963},
     [30] = {items = {{itemid = 2160, count = 2}}, storage = 99964},
     [45] = {items = {{itemid = 2160, count = 2}}, storage = 99965}
   }
}

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, getItemDescriptions(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

REP+++
 
I have this script but not works on my server HELP??
OTX Server 2.51
Tibia 8.60

Code:
local c = {
   [{1,5}] = {
     [20] = {items = {{itemid = 2188, count = 1}}, storage = 99963},
     [30] = {items = {{itemid = 2160, count = 2}}, storage = 99964},
     [45] = {items = {{itemid = 2160, count = 2}}, storage = 99965}
   },
   [{2,6}] = {
     [20] = {items = {{itemid = 2185, count = 1}}, storage = 99963},
     [30] = {items = {{itemid = 2160, count = 2}}, storage = 99964},
     [45] = {items = {{itemid = 2160, count = 2}}, storage = 99965}
   },
   [{3,7}] = {
     [20] = {items = {{itemid = 2160, count = 1}}, storage = 99963},
     [30] = {items = {{itemid = 2160, count = 2}}, storage = 99964},
     [45] = {items = {{itemid = 2160, count = 2}}, storage = 99965}
   },
   [{4,8}] = {
     [20] = {items = {{itemid = 2160, count = 1}}, storage = 99963},
     [30] = {items = {{itemid = 2160, count = 2}}, storage = 99964},
     [45] = {items = {{itemid = 2160, count = 2}}, storage = 99965}
   }
}

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, getItemDescriptions(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

REP+++
Do you get any any errors?
 
Change getItemDescriptions to getItemInfo.
How did you added it? If a script does nothing you can add print under the main function to see if it's added correct.
Code:
print("test")
You will get this message in your console when someone advances.
If you don't see anything, this means it's not added correct or there is an error.
 
Change getItemDescriptions to getItemInfo.
How did you added it? If a script does nothing you can add print under the main function to see if it's added correct.
Code:
print("test")
You will get this message in your console when someone advances.
If you don't see anything, this means it's not added correct or there is an error.

I've added it to creaturescripts.xml
Code:
<event type="advance" name="Reward" event="script" value="rewardlevel.lua"/>
then i register on login like this
Code:
registerCreatureEvent(cid, "Reward")
but it dont works :/
 
[17/6/2015 0:5:38] [Error - CreatureScript Interface]
[17/6/2015 0:5:38] data/creaturescripts/scripts/rewardlevel.lua:eek:nAdvance
[17/6/2015 0:5:38] Description:
[17/6/2015 0:5:38] data/creaturescripts/scripts/rewardlevel.lua:43: attempt to index global 'info' (a boolean value)
[17/6/2015 0:5:38] stack traceback:
[17/6/2015 0:5:38] data/creaturescripts/scripts/rewardlevel.lua:43: in function <data/creaturescripts/scripts/rewardlevel.lua:24>
Did you see test in your console after you added print and a player advanced in something?
 
Post the script how it looks like now.
Code:
local c = {
   [{1,5}] = {
     [20] = {items = {{itemid = 2188, count = 1}}, storage = 99963},
     [30] = {items = {{itemid = 2160, count = 2}}, storage = 99964},
     [45] = {items = {{itemid = 2160, count = 2}}, storage = 99965}
   },
   [{2,6}] = {
     [20] = {items = {{itemid = 2185, count = 1}}, storage = 99963},
     [30] = {items = {{itemid = 2160, count = 2}}, storage = 99964},
     [45] = {items = {{itemid = 2160, count = 2}}, storage = 99965}
   },
   [{3,7}] = {
     [20] = {items = {{itemid = 2160, count = 1}}, storage = 99963},
     [30] = {items = {{itemid = 2160, count = 2}}, storage = 99964},
     [45] = {items = {{itemid = 2160, count = 2}}, storage = 99965}
   },
   [{4,8}] = {
     [20] = {items = {{itemid = 2160, count = 1}}, storage = 99963},
     [30] = {items = {{itemid = 2160, count = 2}}, storage = 99964},
     [45] = {items = {{itemid = 2160, count = 2}}, storage = 99965}
   }
}

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, getItemDescriptions(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