• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Lua Function getPlayerSecureMode(cid) / getPlayerFightMode(cid)

Combat.cpp
Remove the lines from 224 to 226

Spells.cpp
Remove the lines from 743 to 750
If you are using tfs 0.4 3777 remove the lines
 
luascript.cpp


getPlayerSecureMode(cid):
PHP:
int32_t LuaScriptInterface::luaGetPlayerSecureMode(lua_State* L)
{
    //getPlayerSecureMode(cid)
    ScriptEnviroment* env = getEnv();
    Player* player = env->getPlayerByUID((uint32_t)popNumber(L));
    if(!player)
    {
        errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
        lua_pushboolean(L, false);
    }
    else
        lua_pushnumber(L, player->getSecureMode());

    return 1;
}

getPlayerFightMode(cid):
PHP:
int32_t LuaScriptInterface::luaGetPlayerFightMode(lua_State* L)
{
    //getPlayerFightMode(cid)
    ScriptEnviroment* env = getEnv();
    Player* player = env->getPlayerByUID((uint32_t)popNumber(L));
    if(!player)
    {
        errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
        lua_pushboolean(L, false);
    }
    else
        lua_pushnumber(L, player->getAttackFactor());

    return 1;
}


simple and useful.
Hello, sorry for post but where exacly put this lines? I dont have getPlayerSecureMode(cid) and getPlayerFightMode(cid). Best regards
 
Hello, sorry for post but where exacly put this lines? I dont have getPlayerSecureMode(cid) and getPlayerFightMode(cid). Best regards

You need to add those methods and register them to luascript.cpp and luascript.h, then you can use them
 
@up
paste it anywhere in luascript.cpp ?

PS: can You do this for me?
 
Last edited:
@up
paste it anywhere in luascript.cpp ?

PS: can You do this for me?
Find luaGetPlayerModes, under it paste the functions Oskar posted. Then find
C++:
    //getPlayerModes(cid)
    lua_register(m_luaState, "getPlayerModes", LuaInterface::luaGetPlayerModes);
and paste
Code:
    //getPlayerSecureMode(cid)
    lua_register(m_luaState, "getPlayerSecureMode", LuaInterface::getPlayerSecureMode);
   
    //getPlayerFightMode(cid)
    lua_register(m_luaState, "getPlayerFightMode", LuaInterface::getPlayerFightMode);
then in luascript h find
C++:
        static int32_t luaGetPlayerModes(lua_State* L);
and paste
C++:
        static int32_t getPlayerSecureMode(lua_State* L);
        static int32_t getPlayerFightMode(lua_State* L);

You don't have to paste it exactly where I showed you, you can do it near other functions. Just showing you the methodology.
 
when I put code Oskar posted, occurs error .

everything's okay maybe I dont see what is head and what is body of function.
LUA:
int32_t LuaInterface::luaGetPlayerModes(lua_State* L)
{
    //getPlayerModes(cid)
    ScriptEnviroment* env = getEnv();

    Player* player = env->getPlayerByUID(popNumber(L));
    if(!player)
    {
        errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
        lua_pushboolean(L, false);
        return 1;
    }
under which i have to drop oskar codes? sorry for my knowledge

PS:

I may have one last request . Can You do this in my file ?

 
Last edited:
I'm using otx 2.16 based on 0.3.7. it turns out that its not to my version otx. Again occurs error in luascript.cpp. Thanks for help rep
 
Back
Top