Alyhide
Banned User
Hello, I am wondering if anybody can fix this script? I mean, it doesn't give ANY errors in console, it just simply, does not work.. What the script is supposed to do is once the player reaches level 100, it gives the rank 'Warlord of the Flame' to a character, along with a congratulations message and 100 crystal coins. It is also supposed to show in the player's description, after the guild, level,name,etc.
Part 1:
LUA:
local t = {
[100] = {id = 2160, count = 100, desc = "Warlord of the Flame"}
}
local storage = 7500
function onAdvance(cid, skill, oldLevel, newLevel)
local i = t[newLevel]
if skill == SKILL__LEVEL and newLevel == i and getCreatureStorage(cid, storage) < newLevel then
local first = function()
local reward = doCreateItemEx(i.id, i.count)
if doPlayerAddItemEx(cid, reward, true) ~= RETURNVALUE_NOERROR then
return false
end
doSendMagicEffect(getThingPos(cid), CONST_ME_FIREWORK_YELLOW)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Congratulations, you have reached level " .. i .. "! You are now ranked " .. i.desc .. ".")
return true
end
if first then
doCreatureSetStorage(cid, storage, newLevel)
end
end
return true
end
Part 2:
LUA:
local t = {
[100] = {"Warlord of the Flame"}
}
local storage = 7500
function onLook(cid, thing, position, lookDistance)
return isPlayer(thing.uid) and doPlayerSetSpecialDescription(thing.uid, (getPlayerSex(thing.uid) == 0 and ".\nShe" or ".\nHe") .. " is ranked " .. t[getCreatureStorage(thing.uid, storage)][1] .. ".") and true
end