Last active
April 15, 2016 22:36
-
-
Save TeoTwawki/70904555fbed94f385999c43fbcb3f06 to your computer and use it in GitHub Desktop.
set skill and rank by ID
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------------------------------------------------------------------------------------------------- | |
-- func: @setskill <skill ID> <skill Level> <skill Rank> <target> | |
-- desc: Sets specified skill. The IDs can be found in status.lua | |
-- will report targets current skill lv and craft rank if no values specified. | |
--------------------------------------------------------------------------------------------------- | |
cmdprops = | |
{ | |
permission = 1, | |
parameters = "iiis" | |
}; | |
function onTrigger(player, skillID, skillLV, skillRank, target) | |
local targ = nil; | |
if (target == nil) then | |
targ = player | |
else | |
targ = GetPlayerByName(target); | |
end | |
if (targ == nil) then | |
player:PrintToPlayer(string.format("Player named '%s' not found!", target)); | |
return; | |
end | |
if (skillID == nil or skillID == 0 or (skillID > 12 and skillID < 25) | |
or skillID == 46 or skillID == 47 or skillID > 57) then | |
player:PrintToPlayer("Must specify a valid skill.") | |
return; | |
end | |
if (skillLV == nil and skillRank == nil) then | |
player:PrintToPlayer(string.format("%s's skill level is %d for skill with ID %d", targ:getName(), targ:getSkillLevel(skillID), SkillID)); | |
if (skillID > 47) then | |
player:PrintToPlayer(string.format("%s's skill rank is %d for craft skill with ID %d", targ:getName(), targ:getSkillRank(skillID), SkillID)) | |
end | |
else | |
targ:setSkillLevel(skillID, skillLV); | |
targ:messageBasic(53, skillID, skillLV); | |
player:PrintToPlayer(string.format("%s's skill level was set to %d for skill with ID %d", targ:getName(), skillLV, skillID)); | |
if (skillID > 47 and skillRank ~= nil) then | |
targ:setSkillRank(skillID, skillRank); | |
player:PrintToPlayer(string.format("%s's skill rank was set to %d for skill with ID %d", targ:getName(), skillRank, skillID)); | |
end | |
end | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment