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

Unlocked Outfit TFS 1.2

president vankk

Web Developer & AuraOT Owner
Joined
Jul 10, 2009
Messages
5,719
Solutions
9
Reaction score
339
Hi everyone, could someone explain me how it works? I found a few things on GitHub but doesn't explain anything and I don't quite understand.

Thanks.
 
Okay : Sources Part

on outfit.cpp on ThisLine

add comma (,) then add this line outfitNode.attribute("isVip").as_bool(false)

on outfit.h on ThisLine

Replace the whole struct for this.

Code:
struct Outfit {
    Outfit(std::string name, uint16_t lookType, bool premium, bool unlocked, bool isVip) : name(name), lookType(lookType), premium(premium), unlocked(unlocked), isVip(isVip) {}

    std::string name;
    uint16_t lookType;
    bool premium;
    bool unlocked;
    bool isVip;
};

on Player.h

Above this bool pzLocked;

add this bool vipStatus;

-----------------------------------------------

Above this
Code:
void switchGhostMode() {
            ghostMode = !ghostMode;
        }

add this :
Code:
bool isVip() const {
            return vipStatus;
        }
        void switchVip(bool val) {
            vipStatus = val;
        }


on Player.cpp

above this experience = 0;

add this vipStatus = false;

---------------------------------------------------

On this function bool Player::getOutfitAddons

Add this wherever after access condition
Code:
if (outfit.isVip && !vipStatus) {
        return false;
    }


On this function bool Player::carWear

Above if (outfit->premium && !isPremium()) {
Add this
Code:
if (outfit->isVip && !vipStatus) {
        return false;
    }


on LuaScript.h

static int luaPlayerSetVipStatus(lua_State* L);
static int luaPlayerIsVipStatus(lua_State* L);

on LuaScript.cpp

Add these
registerMethod("Player", "setVipStatus", LuaScriptInterface::luaPlayerSetVipStatus);
registerMethod("Player", "getVipStatus", LuaScriptInterface::luaPlayerIsVipStatus);



Add Also these

Code:
int LuaScriptInterface::luaPlayerSetVipStatus(lua_State* L)
{
    // player:setVipStatus(enabled)
    Player* player = getUserdata<Player>(L, 1);
    if (!player) {
        lua_pushnil(L);
        return 1;
    }

    bool enabled = getBoolean(L, 2);
   
    player->switchVip(enabled);
    pushBoolean(L, true);
    return 1;
}
int LuaScriptInterface::luaPlayerIsVipStatus(lua_State* L)
{
    // player:getVipStatus()
    const Player* player = getUserdata<const Player>(L, 1);
    if (player) {
        pushBoolean(L, player->isVip());
    }
    else {
        lua_pushnil(L);
    }
    return 1;
}

 
What to do next in sources.
in creaturescripts.xml add this :

Code:
<event type="think" interval="2000" name="instantVipStatus" script="instantVipStatus.lua"/>

in login.lua

add this

Code:
player:registerEvent('instantVipStatus')

create file called data/creaturescripts/scripts/instantVipStatus.lua

in instantVipStatus.lua

Add this :
Code:
function onThink(player, interval)
    if player:getVipDays() > 0 then
        player:setVipStatus(true)
    else
        player:setVipStatus(false)
    end
end


---- How to use ?



Now in outfits.xml add this to falg isVip="1"

This is a simple outfit

<outfit type="1" looktype="760" name="Halloween" premium="1" unlocked="1" isVip="1" enabled="1" />
 
Back
Top