• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Help! Losing Promotion When Re-Logging

Status
Not open for further replies.

Elixir

Newblet Mapper
Joined
Jun 19, 2012
Messages
74
Reaction score
2
Location
I am a guy.
So I am trying to get a working !promote/!promotion system going but everytime they character that just bought the promotion, logs out/dies, they lose the promotion...
The scripts I am using are
XML:
<talkaction words="!promote" event="script" value="promote.lua"/>
and
LUA:
local config = {
promotion = 1, -- promotion level, default = 1 . Ignore if you don't have new vocations.
minLevel = 20, -- Level needed to buy promotion
cost = 20000, -- Promotion cost in gp
premium = "yes" -- is premium needed to buy promotion?
}

local disabledVocations = {0}

config.premium = getBooleanFromString(config.premium)

function onSay(cid, words, param)
if(isInArray(disabledVocations, getPlayerVocation(cid)) == TRUE) then
doPlayerSendCancel(cid, "Your vocation cannot buy promotion.")
elseif(config.premium == TRUE and isPremium(cid) == FALSE) then
doPlayerSendCancel(cid, "You need a premium account.")
elseif(getPlayerPromotionLevel(cid) >= config.promotion) then
doPlayerSendCancel(cid, "You are already promoted.")
elseif(getPlayerLevel(cid) < config.minLevel) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need " .. config.minLevel .. " to get promotion.")
elseif(doPlayerRemoveMoney(cid, config.cost) ~= TRUE) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You do not have enought money! (Promotion cost " .. config.cost .. " gp.")
else
setPlayerPromotionLevel(cid, config.promotion)
doSendAnimatedText(getCreaturePosition(cid), '*Promoted*', TEXTCOLOR_RED)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have been succesful promoted to " .. getVocationInfo(getPlayerVocation(cid)).name .. ".")
end
return TRUE
end

I don't know what Im using, pretty new to scripting and what not.
But heres a pic of the folder, maybe someone can tell form the pic.
3qXIf.png
 
Status
Not open for further replies.
Back
Top