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

OTClient Need help to make shader appear on players like it does on Gms, please?

origamidoizin

Member
Joined
Jan 2, 2024
Messages
19
Reaction score
6

Attachments

C++:
bool Player::hasShader(const Shader* shader) const
{
 
    if (isAccessPlayer()) {
        return true;
    }

    if (shader->premium && !isPremium()) {
        return false;
    }

    int32_t customStorageValue;
    getStorageValue(123456, customStorageValue);

    if (customStorageValue > 0) {
        return true;
    }
    const uint8_t tmpShaderId = shader->id - 1;

    int32_t value;
    if (!getStorageValue(PSTRG_SHADERS_RANGE_START + (tmpShaderId / 31), value)) {
        return false;
    }

    return ((1 << (tmpShaderId % 31)) & value) != 0;
}

This system work with storages based on the range provided, you can try to add a custom storage anyway, you can edit Shaders Class and add custom storages for shaders.xml if you want make it more readable and fiendly.

Lua:
player:setStorageValue(123456, 1) -- Here you can test with normal storage if it works fine for all characters who have this storage > 0
 
Last edited:
C++:
bool Player::hasShader(const Shader* shader) const
{
 
    if (isAccessPlayer()) {
        return true;
    }

    if (shader->premium && !isPremium()) {
        return false;
    }

    int32_t customStorageValue;
    getStorageValue(123456, customStorageValue);

    if (customStorageValue > 0) {
        return true;
    }
    const uint8_t tmpShaderId = shader->id - 1;

    int32_t value;
    if (!getStorageValue(PSTRG_SHADERS_RANGE_START + (tmpShaderId / 31), value)) {
        return false;
    }

    return ((1 << (tmpShaderId % 31)) & value) != 0;
}

This system work with storages based on the range provided, you can try to add a custom storage anyway, you can edit Shaders Class and add custom storages for shaders.xml if you want make it more readable and fiendly.

Lua:
player:setStorageValue(123456, 1) -- Here you can test with normal storage if it works fine for all characters who have this storage > 0
ty bro but where it should goes? im not that good on c++ :s
 
Follow my two changes:

and

Now on any script add the custom storage of the shader.
Code:
player:setStorageValue(yourStorageInShaders.xml, 1)

And for remove

Code:
player:setStorageValue(yourStorageInShaders.xml, 0)
 
Last edited:
As far as I know, your source doesn't have the functionality to receive wings, auras, and shaders. You need to add it to allow regular players to receive them. So, follow what Levi posted, make the necessary changes, compile it,

and then there's another part that needs modification for the player to receive them normally.

look for this line.
C++:
else if (IS_IN_KEYRANGE(key, MOUNTS_RANGE) || IS_IN_KEYRANGE(key, WINGS_RANGE) || IS_IN_KEYRANGE(key, AURAS_RANGE)) {
// do nothing
}
change to.
C++:
else if (IS_IN_KEYRANGE(key, MOUNTS_RANGE) || IS_IN_KEYRANGE(key, WINGS_RANGE) || IS_IN_KEYRANGE(key, AURAS_RANGE)|| IS_IN_KEYRANGE(key, SHADERS_RANGE)) {
// do nothing
}
 
To use shaders I need add sprites or something?.someone has an example?
shader? There are no sprites for it... It's just a Lua file. The latest OTClient version already comes with it like that. However, you need to configure it correctly for your server... Go to data/xml/shader.lua and add this.

XML:
 <shader id="2" name="Rainbow Outfit" premium="no" />


Check the folder of your OTClient v8 data/modules_shaders/shaders.lua and see if the name is correct, for example, 'Rainbow Outfit'. It will automatically pull and display the colors of your Outfit. Make sure to configure it correctly, okay?
 
Back
Top