• 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++ Npc trade

Blade33711

Member
Joined
Aug 6, 2012
Messages
133
Solutions
1
Reaction score
5
Location
Poland
Hi everyone! I'm using tfs 0.4
I need a help. How to make the function also work with npc?
8a1yci.png


C++:
int32_t LuaInterface::luaDoStartTrade(lua_State* L)
{
    ScriptEnviroment* env = getEnv();

    Item* item = env->getItemByUID(popNumber(L));
    if(!item)
    {
        errorEx(getError(LUA_ERROR_ITEM_NOT_FOUND));
        lua_pushboolean(L, false);
        return 1;
    }

    Player* target = env->getPlayerByUID(popNumber(L));
    Player* player = env->getPlayerByUID(popNumber(L));
    if(!player || !target)
    {
        errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
        lua_pushboolean(L, false);
        return 1;
    }


    if(g_game.internalStartTrade(player, target, item))
    {
        lua_pushboolean(L, true);
        return 1;
    }
    return 1;
}

bump

bump

bump
 
Last edited by a moderator:
Back
Top