• 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 Premium can not buy promotion error

chupaescadatri

Banned User
Joined
Jul 5, 2014
Messages
338
Reaction score
49
NPC does not recognize who is premium,
even with premium he says that the player needs to premium and does not sell promotion.
and the boats did not recognize the premium and sells ticket to any city even for free accounts.
how to fix?

Config.lua:
Code:
    -- Premium account
    freePremium = false
    premiumForPromotion = true
    removePremiumOnInit = true
NPC/Scripts/Promotion.lua:

Code:
-- This is an example NPC script that can be used on Jiddo's NPC system

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid)              npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)           npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)      npcHandler:onCreatureSay(cid, type, msg) end
function onThink()                          npcHandler:onThink() end
-- OTServ event handling functions end

local node1 = keywordHandler:addKeyword({'promotion'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to be promoted in your vocation for 20000 gold?'})
    node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, promotion = 1, cost = 20000,  premium = false, level = 20, text = 'Congratulations! You are now promoted.'})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Allright then. Come back when you are ready.', reset = true})

npcHandler:addModule(FocusModule:new())
Modules.lua:
Code:
    --Usage:
        -- local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})
        --         node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20}, text = 'Congratulations! You are now promoted.')
        --         node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, text = 'Allright then. Come back when you are ready.'}, reset = true)
    function StdModule.promotePlayer(cid, message, keywords, parameters, node)
        local npcHandler = parameters.npcHandler
        if(npcHandler == nil) then
            error('StdModule.promotePlayer called without any npcHandler instance.')
        end
        if(cid ~= npcHandler.focus) then
            return false
        end

        if(isPremium(cid) or isPlayerPremiumCallback == nil or isPlayerPremiumCallback(cid) == true or parameters.premium == false) then
            local oldVoc = getPlayerVocation(cid)
            if(parameters.promotions[oldVoc] == oldVoc or parameters.promotions[oldVoc] == nil) then
                npcHandler:say('You are already promoted!')
            elseif(getPlayerLevel(cid) < parameters.level) then
                npcHandler:say('I am sorry, but I can only promote you once you have reached level ' .. parameters.level .. '.')
            elseif(doPlayerRemoveMoney(cid, parameters.cost) ~= TRUE) then
                npcHandler:say('You do not have enough money!')
            else
                doPlayerSetVocation(cid, parameters.promotions[oldVoc])
                npcHandler:say(parameters.text)
            end
        else
            npcHandler:say('Sorry, only premium characters are allowed to be promoted.')
        end
       
        npcHandler:resetNpc()
        return true
       
    end
 
This is the source of the premium account to buy promotion, I found that premium buy house works just right
promotion but anyone can buy premium and free account, then maybe the error is in the source:
Code:
        if(player->isPromoted() && g_vocations.getPromotedVocation(player->getVocationId()) != 0)
            player->setVocation(((player->isPremium() || !g_config.getBool(ConfigManager::PREMIUM_FOR_PROMOTION)) ? g_vocations.getPromotedVocation(player->vocation->getFromVocation()) : player->vocation->getFromVocation()));
This is the source of the house that works perfectly for the premium buy:
Code:
                            if(!g_config.getBool(ConfigManager::HOUSE_NEED_PREMIUM) || player->isPremium())
Any idea?
 
Back
Top