Elexonic
Well-Known Member
- Joined
- Jun 18, 2008
- Messages
- 1,920
- Reaction score
- 59
I bring this script to that point when players advance their skills .. , If you find a bug, or any improvement will only say it and added..
I think you can put even more understandable .. but I think it has to work well.
Code edited by Scarlet Ayleid
I think you can put even more understandable .. but I think it has to work well.
Code:
local config = { points = 5,
skillStor = 56364,
level = 100,
skills = {
[SKILL__MAGLEVEL] = {level = 95, vocs = {1, 2}},
[SKILL_FIST] = {level = 110, vocs = {1, 4}},
[SKILL_SWORD] = {level = 110, vocs = {4}},
[SKILL_CLUB] = {level = 110, vocs = {4}},
[SKILL_AXE] = {level = 110, vocs = {4}},
[SKILL_SHIELD] = {level = 110, vocs = {4}},
[SKILL_DISTANCE] = {level = 125, vocs = {3}}
}
}
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 5 Premium Points!", MESSAGE_STATUS_CONSOLE_RED)
setPlayerStorageValue(cid, config.skillStor, 1)
end
end
end
end
return TRUE
end
Code edited by Scarlet Ayleid
Last edited: