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

C++ Crash when reloading creaturescripts

Switch

New Member
Joined
Oct 27, 2020
Messages
21
Reaction score
3
I'm trying to pass an "NetworkMessage" in creaturescripts, everything works perfect, but when I try to reaload the creaturescripts the server goes down

Follow the code snippet I added

C++:
void CreatureEvent::executeOpcode(Player* player, uint8_t recvbyte, NetworkMessage& msg)
{
    //onOpcode(player, recvbyte, msg)
    if (!scriptInterface->reserveScriptEnv()) {
        std::cout << "[Error - CreatureEvent::executedOpcode] Call stack overflow" << std::endl;
        return;
    }

    ScriptEnvironment* env = scriptInterface->getScriptEnv();
    env->setScriptId(scriptId, scriptInterface);

    lua_State* L = scriptInterface->getLuaState();

    scriptInterface->pushFunction(scriptId);

    LuaScriptInterface::pushUserdata<Player>(L, player);
    LuaScriptInterface::setMetatable(L, -1, "Player");

    lua_pushnumber(L, recvbyte);

    LuaScriptInterface::pushUserdata<NetworkMessage>(L, &msg);
    LuaScriptInterface::setMetatable(L, -1, "NetworkMessage");

    scriptInterface->callVoidFunction(3);
}

and this is the error that gives...

1606082215312.png


1606082274364.png
 

Attachments

Back
Top