Feature Disable Effects Command

Shadow_

Veteran OT User
Joined
Jun 2, 2018
Messages
901
Solutions
29
Reaction score
331
Hey everybody,
Most of you noticed what happened yesterday so it was just a miss understanding between me and the staff of otland so i decided to release this because it is frequently asked by players while it is so simple to do.
This script is made for AsgardOT and wasn't going to make it unless @mRefaat requested it.
What does it do?
when you cast this command !effects effects get disabled if it is already disabled it get enabled.
Talkactions.xml
Code:
    <talkaction words="!effects" separator=" " script="effects.lua"/>
effects.lua
Lua:
local cooldown = 15

function onSay(player, words, param)
    if player:getStorageValue(storage) <= os.time() then
        player:setStorageValue(storage, os.time() + cooldown)
        if player:getStorageValue(48091) <= 0 then
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You have de-activated effects.")
            player:setStorageValue(48091, 1)
        else
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You have activated effects.")
            player:setStorageValue(48091, -1)    
        end
    else
        player:sendCancelMessage("Can only be executed once every " .. cooldown .. " seconds. Remaining cooldown: " .. player:getStorageValue(storage) - os.time())
    end
    return false
end

protocolgame.cpp
Find those and change them with those
C++:
void ProtocolGame::sendDistanceShoot(const Position& from, const Position& to, uint8_t type)
{
    NetworkMessage msg;
    msg.addByte(0x85);
    msg.addPosition(from);
    msg.addPosition(to);
    msg.addByte(type);
    writeToOutputBuffer(msg);
}

void ProtocolGame::sendMagicEffect(const Position& pos, uint8_t type)
{
    if (!canSee(pos)) {
        return;
    }
    NetworkMessage msg;
    msg.addByte(0x83);
    msg.addPosition(pos);
    msg.addByte(type);
    writeToOutputBuffer(msg);
}
C++:
int32_t effectstor = 48091;
int32_t effectval = -1;
void ProtocolGame::sendDistanceShoot(const Position& from, const Position& to, uint8_t type)
{
    if (player->getStorageValue(effectstor, effectval))
    {
    NetworkMessage msg;
    msg.addByte(0x85);
    msg.addPosition(from);
    msg.addPosition(to);
    msg.addByte(type);
    writeToOutputBuffer(msg);
    }
}

void ProtocolGame::sendMagicEffect(const Position& pos, uint8_t type)
{
    if (!canSee(pos)) {
        return;
    }
    if (player->getStorageValue(effectstor, effectval))
    {
    NetworkMessage msg;
    msg.addByte(0x83);
    msg.addPosition(pos);
    msg.addByte(type);
    writeToOutputBuffer(msg);
    }
}

enjoy.
 
Last edited:
Top