• 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++ executeTalkaction 0.4 to 1.3

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,188
Solutions
34
Reaction score
200
I need help to change this function 0.4 to 1.3
want to use like:
creature:executeTalkAction("/up")
C++:
    //doCreatureExecuteTalkAction(cid, text[, ignoreAccess = false[, channelId = CHANNEL_DEFAULT]])
    lua_register(m_luaState, "doCreatureExecuteTalkAction", LuaInterface::luaDoCreatureExecuteTalkAction);
C++:
int32_t LuaInterface::luaDoCreatureExecuteTalkAction(lua_State* L)
{
    //doCreatureExecuteTalkAction(cid, text[, ignoreAccess = false[, channelId = CHANNEL_DEFAULT]])
    uint32_t params = lua_gettop(L), channelId = CHANNEL_DEFAULT;
    if(params > 3)
        channelId = popNumber(L);

    bool ignoreAccess = false;
    if(params > 2)
        ignoreAccess = popNumber(L);

    std::string text = popString(L);
    ScriptEnviroment* env = getEnv();
    if(Creature* creature = env->getCreatureByUID(popNumber(L)))
        lua_pushboolean(L, g_talkActions->onPlayerSay(creature, channelId, text, ignoreAccess));
    else
    {
        errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND));
        lua_pushboolean(L, false);
    }

    return 1;
}
 
Back
Top