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

[LUA] Make character get a crystal coin when he gets level 50!

LUA:
function onAdvance(cid, skill, oldLevel, newLevel)

local config = {
[20] = {item = 2160, count = 5},
[50] = {item = 2160, count = 5},
[100] = {item = 2160, count = 5},
[110] = {item = 2160, count = 5},
[120] = {item = 2160, count = 5},
[130] = {item = 2160, count = 5},
[140] = {item = 2160, count = 5},
[150] = {item = 2160, count = 5},
[160] = {item = 2160, count = 5},
[170] = {item = 2160, count = 5},
[180] = {item = 2160, count = 5},
[190] = {item = 2160, count = 5},
[200] = {item = 2160, count = 5},
[210] = {item = 2160, count = 5},
[220] = {item = 2160, count = 5},
[230] = {item = 2160, count = 5},
[240] = {item = 2160, count = 5},
[250] = {item = 2160, count = 5},
[260] = {item = 2160, count = 5},
[270] = {item = 2160, count = 5},
[280] = {item = 2160, count = 5},
[290] = {item = 2160, count = 5},
[300] = {item = 2160, count = 5},
[320] = {item = 2160, count = 5},
[330] = {item = 2160, count = 5},
[340] = {item = 2160, count = 5},
[350] = {item = 2160, count = 5},
[360] = {item = 2160, count = 5},
[370] = {item = 2160, count = 5},
[380] = {item = 2160, count = 30},
[390] = {item = 2160, count = 40},
[400] = {item = 2160, count = 50},
}

if skill == 8 then
for level, info in pairs(config) do
if newLevel >= level and (getPlayerStorageValue(cid, 30700) == -1 or not (string.find(getPlayerStorageValue(cid, 30700), "'" .. level .. "'"))) then
doPlayerAddItem(cid, info.item, info.count)
doPlayerSendTextMessage(cid, 27, "Parabéns Guerreiro você atingiu o level "..newLevel.." e ganhou "..info.count.." "..getItemNameById(info.item)..".")
local sat = getPlayerStorageValue(cid, 30700) == -1 and "Values: '" .. level .. "'" or getPlayerStorageValue(cid, 30700) .. ",'" .. level .. "'" 
setPlayerStorageValue(cid, 30700, sat)
end
end
end

return TRUE
end
-- auther :vidy (banned)
NOT mine not tested.
try that but its many lvls.
 
This probably wont work, one error I can see from here is that it's supposed to be

LUA:
if newLevel == oldLevel + 1~

not
LUA:
if newLevel >= level
 
Test this!


<event type="advance" name="reward" event="script" value="prize.lua"/>

local t = {
-- [storage], level, itemid, count
[15512] = {50, 2160, 5}
}
function onAdvance(cid, skill, oldLevel, newLevel)
if skill == SKILL__LEVEL then
for storage, v in pairs(t) do
if newLevel >= v[1] and getPlayerStorageValue(cid, storage) < 1 then
doPlayerAddItem(cid, v[2], v[3])
setPlayerStorageValue(cid, storage, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "CONGRATULATIONS! You've reached level " .. v[1] .. ".")
break
end
end
end
return true
end
 
Back
Top