local config = { points = 3,
skillStor = 56364,
level = 150,
skills = {
[SKILL__MAGLEVEL] = {level = 103, vocs = {1, 2, 5, 6, 9, 10}},
[SKILL_FIST] = {level = 110, vocs = {4, 8, 12}},
[SKILL_SWORD] = {level = 113, vocs = {4, 8, 12}},
[SKILL_CLUB] = {level = 110, vocs = {4, 8, 12}},
[SKILL_AXE] = {level = 110, vocs = {4, 8, 12}},
[SKILL_SHIELD] = {level = 110, vocs = {4, 8, 12}},
[SKILL_DISTANCE] = {level = 115, vocs = {3, 7, 11}}
}
}
function onAdvance(cid, skill, oldlevel, newlevel)
if(getPlayerStorageValue(cid, config.skillStor) ~= 1 and getPlayerLevel(cid) >= config.level) then --Check storage and level
if(config.skills[skill] ~= nil) then
if(table.containsNum(getPlayerVocation(cid), config.skills[skill].vocs)) then --Check if the vocation used for this skill is an acceptable one
if(newlevel >= config.skills[skill].level) then --Check if the player has the required skill
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. config.points .. " where id=" .. getPlayerAccountId(cid))
doBroadcastMessage("Congratulations " .. getCreatureName(cid) .. " advanced on skill and received 3 Premium Points!", MESSAGE_STATUS_CONSOLE_RED)
setPlayerStorageValue(cid, config.skillStor, 1)
doWriteLogFile("./data/logs/puntosskill.log", "Success: " .. getCreatureName(cid).. " gain 3 points for skill.")
end
end
end
end
return TRUE
end