• 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!

TFS 0.X Problem with promotion after losing Pacc

cheeses

Member
Joined
Oct 29, 2011
Messages
126
Solutions
2
Reaction score
5
Hello,

I am using tfs 0.4 rev 3887

I have a problem with promotion when player loses pacc. He loses promotion but when he buys again pacc he has to go buy again the promotion, it should re activate promotion for free and I Don't have any idea how to do this, can you help me please?
 
Solution
Solved

Thanks again @Xikini !!

The solution:

creaturescripts.xml

Code:
<event type="login" name="login_fix_promotion_xikini" event="script" value="login_fix_promotion_xikini.lua"/>


creaturescripts/scripts/login_fix_promotion_xikini.lua :


Code:
function onLogin(cid)
    if isPremium(cid) then
        if getPlayerStorageValue(cid, 48914) == 1 then
            if getPlayerVocation(cid) < 5 then
                print("" .. getCreatureName(cid) .. " promotional status has been fixed. (provided promotion)")
                doPlayerSetVocation(cid, getPlayerVocation(cid)+4)
                return true
            end
        end
    end
    if not isPremium(cid) then
        if getPlayerVocation(cid) > 4 then
            print("" ...
just store something in a storage value onLogin when the player is not pacc anymore and promoted, with another function onLogin, if he is pacc and has that storage value, promote the player.....
 
just store something in a storage value onLogin when the player is not pacc anymore and promoted, with another function onLogin, if he is pacc and has that storage value, promote the player.....

That's what we tried to do : saving the condition of promotion on login but it is allways saving as 0 :/
 
Solved

Thanks again @Xikini !!

The solution:

creaturescripts.xml

Code:
<event type="login" name="login_fix_promotion_xikini" event="script" value="login_fix_promotion_xikini.lua"/>


creaturescripts/scripts/login_fix_promotion_xikini.lua :


Code:
function onLogin(cid)
    if isPremium(cid) then
        if getPlayerStorageValue(cid, 48914) == 1 then
            if getPlayerVocation(cid) < 5 then
                print("" .. getCreatureName(cid) .. " promotional status has been fixed. (provided promotion)")
                doPlayerSetVocation(cid, getPlayerVocation(cid)+4)
                return true
            end
        end
    end
    if not isPremium(cid) then
        if getPlayerVocation(cid) > 4 then
            print("" .. getCreatureName(cid) .. " promotional status has been fixed. (reduced promotion)")
            doPlayerSetVocation(cid, getPlayerVocation(cid)-4)
            return true
        end
    end
    return true
end

creaturescripts/scripts/login.lua: (register the event)

Code:
registerCreatureEvent(cid, "login_fix_promotion_xikini")
in your promotion npc script above this function :
Code:
                selfSay('You are now promoted!', cid)

add:
Code:
                doPlayerSetStorageValue(cid, 48914, 1)
 
Last edited:
Solution
Back
Top