• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Help tfs 1.2 Lose Promotion Script

gohamvsgoku

Member
Joined
Aug 21, 2017
Messages
151
Reaction score
9
my script on login.lua

Script
LUA:
    -- Promotion
    if player:isPremium() then
        if player:getVocation():getId() ~= 0 and player:getVocation():getId() < 5 and player:getStorageValue(30018) == 1 then
            player:setVocation(player:getVocation():getId() + 4)
        end
    else
        if player:getVocation():getId() ~= 0 and player:getVocation():getId() > 4 then
            player:setVocation(player:getVocation():getId() - 4)
        end
    end

when the player is premium account and has promotion, when he gets free account, he loses the promotion right!, but my problem if he purchases premium account again he continues without the promotion which he bought before. how can i fix this problem?
 
LUA:
    -- Promotion
    if player:isPremium() then
        if player:getVocation():getId() ~= 0 and player:getVocation():getId() < 5 and player:getStorageValue(30018) == 1 then
            player:setVocation(player:getVocation():getId() + 4)
        end
    else
        if player:getVocation():getId() ~= 0 and player:getVocation():getId() > 4 then
            player:setVocation(player:getVocation():getId() - 4)
            player:setStorageValue(30018, 1)
        end
    end
what is this storage value? 30018
 
i found in sources
C++:
int32_t newVocation = player->getVocationId() + 4;
player->setVocation(newVocation);
player->addStorageValue(30018, 1);
 
what is this storage value? 30018
probably when he buy a promotion, he get a storage 30018, value 1.
because if he lost premium and get new premium acc again, he dont need to get promotion again, because will have this storage
 
Back
Top