Hello again,
I have been having a small problem with a promotion script i have made, everything works perfectly fine for it however when players log out and log back in they lose the promotion.
Is there anyway for me to be able to fix this in login.lua.
Client version is 8.6 and the tfs is 0.4
Thanks in advance.
I have been having a small problem with a promotion script i have made, everything works perfectly fine for it however when players log out and log back in they lose the promotion.
Is there anyway for me to be able to fix this in login.lua.
Client version is 8.6 and the tfs is 0.4
Thanks in advance.
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local cfg = {
level = 1, --- level to use items
vocs = { 5, 6, 7, 8 }, --- put here vocation must use items
storage = 452473991 --- set any empty storage
}
if(getPlayerStorageValue(cid, cfg.storage) == -1) then
if(getPlayerLevel(cid) >= cfg.level) then
if(isInArray(cfg.vocs, getPlayerVocation(cid)) == true) then
setPlayerPromotionLevel(cid, getPlayerPromotionLevel(cid) + 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have been promoted to " .. getVocationInfo(getPlayerVocation(cid)).name .. ".")
doSendMagicEffect(getCreaturePosition(cid), 55)
setPlayerStorageValue(cid, cfg.storage, 1)
doRemoveItem(item.uid, 1)
else
doCreatureSay(cid, "Only players with first promotion may get their Second promotion.", TALKTYPE_ORANGE_1)
end
else
doCreatureSay(cid, "Sorry, only characters of level " .. cfg.level .. " or above can buy Second Promotion.", TALKTYPE_ORANGE_1)
end
else
doCreatureSay(cid, "You have already purchased the Second Promotion.", TALKTYPE_ORANGE_1)
end
return
end
Last edited by a moderator: