slaw
Software Developer
This code will add to your server new lua function which will clean your map.
Tested only on TFS.
luascript.cpp
after
add
after
add
luascript.h
after
add
Now you can use in all .lua scripts funcion: cleanMap() - it work same as /clean, it will show in console how much items was cleaned.
Later i will give an example for automatic map clean after every xx minutes.
Tested only on TFS.
luascript.cpp
after
Code:
//savePlayers()
lua_register(m_luaState, "savePlayers", LuaScriptInterface::luaSavePlayers);
Code:
//cleanmap()
lua_register(m_luaState, "cleanMap", LuaScriptInterface::luaCleanMap);
after
Code:
int32_t LuaScriptInterface::luaSavePlayers(lua_State* L)
{
g_game.saveData(false);
return 1;
}
Code:
int32_t LuaScriptInterface::luaCleanMap(lua_State* L)
{
g_game.getMap()->clean();
return 1;
}
luascript.h
after
Code:
static int32_t luaSavePlayers(lua_State* L);
Code:
static int32_t luaCleanMap(lua_State* L);
Now you can use in all .lua scripts funcion: cleanMap() - it work same as /clean, it will show in console how much items was cleaned.
Later i will give an example for automatic map clean after every xx minutes.