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

Compiling Help to add this func on my sources

dawnking

Member
Joined
Jun 23, 2016
Messages
176
Reaction score
22
I tried to add this funcs in my sources:
https://otland.net/threads/getotsystime-getplayerping-cid-doplayersendping-cid.121182/

I think i made something worng
Like guys ask to suport here... Everything i change i put inside
Code:
// getOtsysTime() + getPlayerPing(cid) + doPlayerSendPing(cid)

// end

Errors when compile
Code:
In file included from luascript.h:33:0,
  from luascript.cpp:18:
luascript.cpp: In member function ‘virtual void LuaInterface::registerFunctions()’:
luascript.cpp:2091:47: error: ‘LuaScriptInterface’ has not been declared
  lua_register(m_luaState, "doPlayerSendPing", LuaScriptInterface::luadoPlayerSendPing);
  ^
/usr/include/lua5.1/lua.h:260:53: note: in definition of macro ‘lua_pushcfunction’
#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)
  ^
luascript.cpp:2091:2: note: in expansion of macro ‘lua_register’
  lua_register(m_luaState, "doPlayerSendPing", LuaScriptInterface::luadoPlayerSendPing);
  ^
luascript.cpp:2093:48: error: ‘LuaScriptInterface’ has not been declared
  lua_register(m_luaState, "getPlayerLastPing", LuaScriptInterface::luagetPlayerLastPing);
  ^
/usr/include/lua5.1/lua.h:260:53: note: in definition of macro ‘lua_pushcfunction’
#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)
  ^
luascript.cpp:2093:2: note: in expansion of macro ‘lua_register’
  lua_register(m_luaState, "getPlayerLastPing", LuaScriptInterface::luagetPlayerLastPing);
  ^
luascript.cpp:2095:48: error: ‘LuaScriptInterface’ has not been declared
  lua_register(m_luaState, "getPlayerLastPong", LuaScriptInterface::luagetPlayerLastPong);
  ^
/usr/include/lua5.1/lua.h:260:53: note: in definition of macro ‘lua_pushcfunction’
#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)
  ^
luascript.cpp:2095:2: note: in expansion of macro ‘lua_register’
  lua_register(m_luaState, "getPlayerLastPong", LuaScriptInterface::luagetPlayerLastPong);
  ^
luascript.cpp:2097:43: error: ‘LuaScriptInterface’ has not been declared
  lua_register(m_luaState, "getOtsysTime", LuaScriptInterface::luagetOtsysTime);
  ^
/usr/include/lua5.1/lua.h:260:53: note: in definition of macro ‘lua_pushcfunction’
#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)
  ^
luascript.cpp:2097:2: note: in expansion of macro ‘lua_register’
  lua_register(m_luaState, "getOtsysTime", LuaScriptInterface::luagetOtsysTime);
  ^
luascript.cpp: At global scope:
luascript.cpp:10929:9: error: ‘LuaScriptInterface’ has not been declared
int32_t LuaScriptInterface::luadoPlayerSendPing(lua_State* L)
  ^
luascript.cpp: In function ‘int32_t luadoPlayerSendPing(lua_State*)’:
luascript.cpp:10932:33: error: ‘getEnv’ was not declared in this scope
  ScriptEnviroment* env = getEnv();
  ^
luascript.cpp:10933:50: error: ‘popNumber’ was not declared in this scope
  Player* player = env->getPlayerByUID(popNumber(L));
  ^
In file included from luascript.cpp:26:0:
player.h:1196:11: error: ‘int64_t Player::lastPing’ is private
  int64_t lastPing;
  ^
luascript.cpp:10940:13: error: within this context
  player->lastPing = timeNow;
  ^
In file included from luascript.cpp:26:0:
player.h:1216:17: error: ‘ProtocolGame* Player::client’ is private
  ProtocolGame* client;
  ^
luascript.cpp:10941:13: error: within this context
  if(player->client)
  ^
In file included from luascript.cpp:26:0:
player.h:1216:17: error: ‘ProtocolGame* Player::client’ is private
  ProtocolGame* client;
  ^
luascript.cpp:10943:13: error: within this context
  player->client->sendPing();
  ^
In file included from player.h:33:0,
  from luascript.cpp:26:
protocolgame.h:205:8: error: ‘void ProtocolGame::sendPing()’ is private
  void sendPing();
  ^
luascript.cpp:10943:30: error: within this context
  player->client->sendPing();
  ^
luascript.cpp: At global scope:
luascript.cpp:10952:9: error: ‘LuaScriptInterface’ has not been declared
int32_t LuaScriptInterface::luagetOtsysTime(lua_State* L)
  ^
luascript.cpp:10958:9: error: ‘LuaScriptInterface’ has not been declared
int32_t LuaScriptInterface::luagetPlayerLastPing(lua_State* L)
  ^
luascript.cpp: In function ‘int32_t luagetPlayerLastPing(lua_State*)’:
luascript.cpp:10961:33: error: ‘getEnv’ was not declared in this scope
  ScriptEnviroment* env = getEnv();
  ^
luascript.cpp:10962:50: error: ‘popNumber’ was not declared in this scope
  Player* player = env->getPlayerByUID(popNumber(L));
  ^
In file included from luascript.cpp:18:0:
luascript.cpp:10965:46: error: ‘getError’ was not declared in this scope
  errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
  ^
luascript.h:221:40: note: in definition of macro ‘errorEx’
#define errorEx(a) error(__FUNCTION__, a)
  ^
luascript.h:221:41: error: ‘error’ was not declared in this scope
#define errorEx(a) error(__FUNCTION__, a)
  ^
luascript.cpp:10965:3: note: in expansion of macro ‘errorEx’
  errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
  ^
luascript.h:221:41: note: suggested alternatives:
#define errorEx(a) error(__FUNCTION__, a)
  ^
luascript.cpp:10965:3: note: in expansion of macro ‘errorEx’
  errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
  ^
In file included from /usr/include/boost/asio/detail/impl/posix_mutex.ipp:24:0,
  from /usr/include/boost/asio/detail/posix_mutex.hpp:73,
  from /usr/include/boost/asio/detail/mutex.hpp:25,
  from /usr/include/boost/asio/detail/service_registry.hpp:20,
  from /usr/include/boost/asio/impl/io_service.hpp:19,
  from /usr/include/boost/asio/io_service.hpp:767,
  from /usr/include/boost/asio/basic_io_object.hpp:19,
  from /usr/include/boost/asio/basic_socket.hpp:20,
  from /usr/include/boost/asio/basic_datagram_socket.hpp:20,
  from /usr/include/boost/asio.hpp:21,
  from otsystem.h:33,
  from luascript.h:20,
  from luascript.cpp:18:
/usr/include/boost/asio/error.hpp:66:17: note:  ‘boost::asio::error’
namespace error {
  ^
In file included from /usr/include/boost/asio.hpp:82:0,
  from otsystem.h:33,
  from luascript.h:20,
  from luascript.cpp:18:
/usr/include/boost/asio/placeholders.hpp:55:22: note:  ‘boost::asio::placeholders::error’
inline boost::arg<1> error()
  ^
In file included from luascript.cpp:26:0:
player.h:1196:11: error: ‘int64_t Player::lastPing’ is private
  int64_t lastPing;
  ^
luascript.cpp:10970:28: error: within this context
  lua_pushnumber(L, player->lastPing);
  ^
luascript.cpp:10969:10: warning: unused variable ‘timeNow’ [-Wunused-variable]
  int64_t timeNow = OTSYS_TIME();
  ^
luascript.cpp: At global scope:
luascript.cpp:10973:9: error: ‘LuaScriptInterface’ has not been declared
int32_t LuaScriptInterface::luagetPlayerLastPong(lua_State* L)
  ^
luascript.cpp: In function ‘int32_t luagetPlayerLastPong(lua_State*)’:
luascript.cpp:10976:33: error: ‘getEnv’ was not declared in this scope
  ScriptEnviroment* env = getEnv();
  ^
luascript.cpp:10977:50: error: ‘popNumber’ was not declared in this scope
  Player* player = env->getPlayerByUID(popNumber(L));
  ^
In file included from luascript.cpp:18:0:
luascript.cpp:10980:46: error: ‘getError’ was not declared in this scope
  errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
  ^
luascript.h:221:40: note: in definition of macro ‘errorEx’
#define errorEx(a) error(__FUNCTION__, a)
  ^
luascript.h:221:41: error: ‘error’ was not declared in this scope
#define errorEx(a) error(__FUNCTION__, a)
  ^
luascript.cpp:10980:3: note: in expansion of macro ‘errorEx’
  errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
  ^
luascript.h:221:41: note: suggested alternatives:
#define errorEx(a) error(__FUNCTION__, a)
  ^
luascript.cpp:10980:3: note: in expansion of macro ‘errorEx’
  errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
  ^
In file included from /usr/include/boost/asio/detail/impl/posix_mutex.ipp:24:0,
  from /usr/include/boost/asio/detail/posix_mutex.hpp:73,
  from /usr/include/boost/asio/detail/mutex.hpp:25,
  from /usr/include/boost/asio/detail/service_registry.hpp:20,
  from /usr/include/boost/asio/impl/io_service.hpp:19,
  from /usr/include/boost/asio/io_service.hpp:767,
  from /usr/include/boost/asio/basic_io_object.hpp:19,
  from /usr/include/boost/asio/basic_socket.hpp:20,
  from /usr/include/boost/asio/basic_datagram_socket.hpp:20,
  from /usr/include/boost/asio.hpp:21,
  from otsystem.h:33,
  from luascript.h:20,
  from luascript.cpp:18:
/usr/include/boost/asio/error.hpp:66:17: note:  ‘boost::asio::error’
namespace error {
  ^
In file included from /usr/include/boost/asio.hpp:82:0,
  from otsystem.h:33,
  from luascript.h:20,
  from luascript.cpp:18:
/usr/include/boost/asio/placeholders.hpp:55:22: note:  ‘boost::asio::placeholders::error’
inline boost::arg<1> error()
  ^
In file included from luascript.cpp:26:0:
player.h:1195:11: error: ‘int64_t Player::lastPong’ is private
  int64_t lastPong;
  ^
luascript.cpp:10984:28: error: within this context
  lua_pushnumber(L, player->lastPong);
  ^
mv -f .deps/items.Tpo .deps/items.Po
g++ -DHAVE_CONFIG_H -I.  -I/usr/include/libxml2  -I/usr/include/lua5.1  -O2 -fomit-frame-pointer -D__USE_MYSQL__  -D__ENABLE_SERVER_DIAGNOSTIC__ -D__ROOT_PERMISSION__ -D_THREAD_SAFE -D_REENTRANT -Wall -Wextra -Wno-strict-aliasing -Wno-unused-parameter -Wno-array-bounds -pthread -pipe -MT manager.o -MD -MP -MF .deps/manager.Tpo -c -o manager.o manager.cpp
Makefile:546: recipe for target 'luascript.o' failed
make[1]: *** [luascript.o] Error 1
make[1]: ** Esperando que outros processos terminem.
mv -f .deps/mailbox.Tpo .deps/mailbox.Po
mv -f .deps/manager.Tpo .deps/manager.Po
make[1]: Leaving directory '/home/pedro/Documentos/otserver/3777/src'
Makefile:403: recipe for target 'all' failed
make: *** [all] Error 2
pedro@pedro-DC8CU41:~/Documentos/otserver/3777/src$

This is my luascript.cpp
http://hastebin.com/imohaqewim.cpp

This is my luascript.h
http://hastebin.com/ameyiyomiz.cpp

I'm using 0.4
 
Last edited:
I tried to add this funcs in my sources:
https://otland.net/threads/getotsystime-getplayerping-cid-doplayersendping-cid.121182/

I think i made something worng
Like guys ask to suport here... Everything i change i put inside
Code:
// getOtsysTime() + getPlayerPing(cid) + doPlayerSendPing(cid)

// end

Errors when compile
Code:
In file included from luascript.h:33:0,
  from luascript.cpp:18:
luascript.cpp: In member function ‘virtual void LuaInterface::registerFunctions()’:
luascript.cpp:2091:47: error: ‘LuaScriptInterface’ has not been declared
  lua_register(m_luaState, "doPlayerSendPing", LuaScriptInterface::luadoPlayerSendPing);
  ^
/usr/include/lua5.1/lua.h:260:53: note: in definition of macro ‘lua_pushcfunction’
#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)
  ^
luascript.cpp:2091:2: note: in expansion of macro ‘lua_register’
  lua_register(m_luaState, "doPlayerSendPing", LuaScriptInterface::luadoPlayerSendPing);
  ^
luascript.cpp:2093:48: error: ‘LuaScriptInterface’ has not been declared
  lua_register(m_luaState, "getPlayerLastPing", LuaScriptInterface::luagetPlayerLastPing);
  ^
/usr/include/lua5.1/lua.h:260:53: note: in definition of macro ‘lua_pushcfunction’
#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)
  ^
luascript.cpp:2093:2: note: in expansion of macro ‘lua_register’
  lua_register(m_luaState, "getPlayerLastPing", LuaScriptInterface::luagetPlayerLastPing);
  ^
luascript.cpp:2095:48: error: ‘LuaScriptInterface’ has not been declared
  lua_register(m_luaState, "getPlayerLastPong", LuaScriptInterface::luagetPlayerLastPong);
  ^
/usr/include/lua5.1/lua.h:260:53: note: in definition of macro ‘lua_pushcfunction’
#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)
  ^
luascript.cpp:2095:2: note: in expansion of macro ‘lua_register’
  lua_register(m_luaState, "getPlayerLastPong", LuaScriptInterface::luagetPlayerLastPong);
  ^
luascript.cpp:2097:43: error: ‘LuaScriptInterface’ has not been declared
  lua_register(m_luaState, "getOtsysTime", LuaScriptInterface::luagetOtsysTime);
  ^
/usr/include/lua5.1/lua.h:260:53: note: in definition of macro ‘lua_pushcfunction’
#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)
  ^
luascript.cpp:2097:2: note: in expansion of macro ‘lua_register’
  lua_register(m_luaState, "getOtsysTime", LuaScriptInterface::luagetOtsysTime);
  ^
luascript.cpp: At global scope:
luascript.cpp:10929:9: error: ‘LuaScriptInterface’ has not been declared
int32_t LuaScriptInterface::luadoPlayerSendPing(lua_State* L)
  ^
luascript.cpp: In function ‘int32_t luadoPlayerSendPing(lua_State*)’:
luascript.cpp:10932:33: error: ‘getEnv’ was not declared in this scope
  ScriptEnviroment* env = getEnv();
  ^
luascript.cpp:10933:50: error: ‘popNumber’ was not declared in this scope
  Player* player = env->getPlayerByUID(popNumber(L));
  ^
In file included from luascript.cpp:26:0:
player.h:1196:11: error: ‘int64_t Player::lastPing’ is private
  int64_t lastPing;
  ^
luascript.cpp:10940:13: error: within this context
  player->lastPing = timeNow;
  ^
In file included from luascript.cpp:26:0:
player.h:1216:17: error: ‘ProtocolGame* Player::client’ is private
  ProtocolGame* client;
  ^
luascript.cpp:10941:13: error: within this context
  if(player->client)
  ^
In file included from luascript.cpp:26:0:
player.h:1216:17: error: ‘ProtocolGame* Player::client’ is private
  ProtocolGame* client;
  ^
luascript.cpp:10943:13: error: within this context
  player->client->sendPing();
  ^
In file included from player.h:33:0,
  from luascript.cpp:26:
protocolgame.h:205:8: error: ‘void ProtocolGame::sendPing()’ is private
  void sendPing();
  ^
luascript.cpp:10943:30: error: within this context
  player->client->sendPing();
  ^
luascript.cpp: At global scope:
luascript.cpp:10952:9: error: ‘LuaScriptInterface’ has not been declared
int32_t LuaScriptInterface::luagetOtsysTime(lua_State* L)
  ^
luascript.cpp:10958:9: error: ‘LuaScriptInterface’ has not been declared
int32_t LuaScriptInterface::luagetPlayerLastPing(lua_State* L)
  ^
luascript.cpp: In function ‘int32_t luagetPlayerLastPing(lua_State*)’:
luascript.cpp:10961:33: error: ‘getEnv’ was not declared in this scope
  ScriptEnviroment* env = getEnv();
  ^
luascript.cpp:10962:50: error: ‘popNumber’ was not declared in this scope
  Player* player = env->getPlayerByUID(popNumber(L));
  ^
In file included from luascript.cpp:18:0:
luascript.cpp:10965:46: error: ‘getError’ was not declared in this scope
  errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
  ^
luascript.h:221:40: note: in definition of macro ‘errorEx’
#define errorEx(a) error(__FUNCTION__, a)
  ^
luascript.h:221:41: error: ‘error’ was not declared in this scope
#define errorEx(a) error(__FUNCTION__, a)
  ^
luascript.cpp:10965:3: note: in expansion of macro ‘errorEx’
  errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
  ^
luascript.h:221:41: note: suggested alternatives:
#define errorEx(a) error(__FUNCTION__, a)
  ^
luascript.cpp:10965:3: note: in expansion of macro ‘errorEx’
  errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
  ^
In file included from /usr/include/boost/asio/detail/impl/posix_mutex.ipp:24:0,
  from /usr/include/boost/asio/detail/posix_mutex.hpp:73,
  from /usr/include/boost/asio/detail/mutex.hpp:25,
  from /usr/include/boost/asio/detail/service_registry.hpp:20,
  from /usr/include/boost/asio/impl/io_service.hpp:19,
  from /usr/include/boost/asio/io_service.hpp:767,
  from /usr/include/boost/asio/basic_io_object.hpp:19,
  from /usr/include/boost/asio/basic_socket.hpp:20,
  from /usr/include/boost/asio/basic_datagram_socket.hpp:20,
  from /usr/include/boost/asio.hpp:21,
  from otsystem.h:33,
  from luascript.h:20,
  from luascript.cpp:18:
/usr/include/boost/asio/error.hpp:66:17: note:  ‘boost::asio::error’
namespace error {
  ^
In file included from /usr/include/boost/asio.hpp:82:0,
  from otsystem.h:33,
  from luascript.h:20,
  from luascript.cpp:18:
/usr/include/boost/asio/placeholders.hpp:55:22: note:  ‘boost::asio::placeholders::error’
inline boost::arg<1> error()
  ^
In file included from luascript.cpp:26:0:
player.h:1196:11: error: ‘int64_t Player::lastPing’ is private
  int64_t lastPing;
  ^
luascript.cpp:10970:28: error: within this context
  lua_pushnumber(L, player->lastPing);
  ^
luascript.cpp:10969:10: warning: unused variable ‘timeNow’ [-Wunused-variable]
  int64_t timeNow = OTSYS_TIME();
  ^
luascript.cpp: At global scope:
luascript.cpp:10973:9: error: ‘LuaScriptInterface’ has not been declared
int32_t LuaScriptInterface::luagetPlayerLastPong(lua_State* L)
  ^
luascript.cpp: In function ‘int32_t luagetPlayerLastPong(lua_State*)’:
luascript.cpp:10976:33: error: ‘getEnv’ was not declared in this scope
  ScriptEnviroment* env = getEnv();
  ^
luascript.cpp:10977:50: error: ‘popNumber’ was not declared in this scope
  Player* player = env->getPlayerByUID(popNumber(L));
  ^
In file included from luascript.cpp:18:0:
luascript.cpp:10980:46: error: ‘getError’ was not declared in this scope
  errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
  ^
luascript.h:221:40: note: in definition of macro ‘errorEx’
#define errorEx(a) error(__FUNCTION__, a)
  ^
luascript.h:221:41: error: ‘error’ was not declared in this scope
#define errorEx(a) error(__FUNCTION__, a)
  ^
luascript.cpp:10980:3: note: in expansion of macro ‘errorEx’
  errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
  ^
luascript.h:221:41: note: suggested alternatives:
#define errorEx(a) error(__FUNCTION__, a)
  ^
luascript.cpp:10980:3: note: in expansion of macro ‘errorEx’
  errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
  ^
In file included from /usr/include/boost/asio/detail/impl/posix_mutex.ipp:24:0,
  from /usr/include/boost/asio/detail/posix_mutex.hpp:73,
  from /usr/include/boost/asio/detail/mutex.hpp:25,
  from /usr/include/boost/asio/detail/service_registry.hpp:20,
  from /usr/include/boost/asio/impl/io_service.hpp:19,
  from /usr/include/boost/asio/io_service.hpp:767,
  from /usr/include/boost/asio/basic_io_object.hpp:19,
  from /usr/include/boost/asio/basic_socket.hpp:20,
  from /usr/include/boost/asio/basic_datagram_socket.hpp:20,
  from /usr/include/boost/asio.hpp:21,
  from otsystem.h:33,
  from luascript.h:20,
  from luascript.cpp:18:
/usr/include/boost/asio/error.hpp:66:17: note:  ‘boost::asio::error’
namespace error {
  ^
In file included from /usr/include/boost/asio.hpp:82:0,
  from otsystem.h:33,
  from luascript.h:20,
  from luascript.cpp:18:
/usr/include/boost/asio/placeholders.hpp:55:22: note:  ‘boost::asio::placeholders::error’
inline boost::arg<1> error()
  ^
In file included from luascript.cpp:26:0:
player.h:1195:11: error: ‘int64_t Player::lastPong’ is private
  int64_t lastPong;
  ^
luascript.cpp:10984:28: error: within this context
  lua_pushnumber(L, player->lastPong);
  ^
mv -f .deps/items.Tpo .deps/items.Po
g++ -DHAVE_CONFIG_H -I.  -I/usr/include/libxml2  -I/usr/include/lua5.1  -O2 -fomit-frame-pointer -D__USE_MYSQL__  -D__ENABLE_SERVER_DIAGNOSTIC__ -D__ROOT_PERMISSION__ -D_THREAD_SAFE -D_REENTRANT -Wall -Wextra -Wno-strict-aliasing -Wno-unused-parameter -Wno-array-bounds -pthread -pipe -MT manager.o -MD -MP -MF .deps/manager.Tpo -c -o manager.o manager.cpp
Makefile:546: recipe for target 'luascript.o' failed
make[1]: *** [luascript.o] Error 1
make[1]: ** Esperando que outros processos terminem.
mv -f .deps/mailbox.Tpo .deps/mailbox.Po
mv -f .deps/manager.Tpo .deps/manager.Po
make[1]: Leaving directory '/home/pedro/Documentos/otserver/3777/src'
Makefile:403: recipe for target 'all' failed
make: *** [all] Error 2
pedro@pedro-DC8CU41:~/Documentos/otserver/3777/src$

This is my luascript.cpp
http://hastebin.com/imohaqewim.cpp

This is my luascript.h
http://hastebin.com/ameyiyomiz.cpp

I wonder if you can ready english or you are just too lazy to do that...
This is never going to work, it's not compatible you would need to convert all the functions cause it clearly says everything is not declared on the scope...
 
I wonder if you can ready english or you are just too lazy to do that...
This is never going to work, it's not compatible you would need to convert all the functions cause it clearly says everything is not declared on the scope...
Im sorry, i just dont know about sources edits...

I trough 0.3.6 was compatible with 0.4

There is another way to get player ping to make a just
Code:
if playerping(cid) > 2000 then
     doRemoveCreature(cid)
end
 
xD you cant just copy paste from one distro to another.. I wish it worked like that, would be BADASS...

Im sorry, i just dont know about sources edits...

I trough 0.3.6 was compatible with 0.4

There is another way to get player ping to make a just
Code:
if playerping(cid) > 2000 then
     doRemoveCreature(cid)
end

Ill tell you right now DO NOT do it this way....
EASILY abusable. xD

I suggest monitoring EVERYONES ping and creating an average variable, then act based on that information... Call it ServerAveragePing or something

Code:
local averageServerPing=0
local playerCount=0

for _, cid in ipairs(getPlayersOnline()) do
        averageServerPing=(getPlayerPing(cid) + averageServerPing)
        playerCount=_
end

averageServerPing=(averageServerPing/playerCount)

if averageServerPing> 2000 then
        doBroadcastMessage("DDos attack! Everyone will be kicked")

        for _, cid in ipairs(getPlayersOnline()) do
          addEvent(function(cid)
                doRemoveCreature(cid)
          end, 1000, cid)

        end
end

Only works for bigger sample sizes. so if your not populated need to edit a bit.

If you are getting DDos'd, everyones ping will go up, not just 1 person... IF thats the origin to your ping dealings

1 person cuts their internet to try and abuse it, it won't effect the variable, as long as your sample size is large enough(enough people are online)..

if your server is getting DDos'd it will be changed drastically due to everyone's ping being effected.

I commend you on the idea :) a lot of servers have completed this task due to DDos, you can probably find a completed system somewhere if you ask/look around.

I believe mastercores and tibianic had/have this feature?
 
Last edited:
xD you cant just copy paste from one distro to another.. I wish it worked like that, would be BADASS...



Ill tell you right now DO NOT do it this way....
EASILY abusable. xD

I suggest monitoring EVERYONES ping and creating an average variable, then act based on that information... Call it ServerAveragePing or something

Code:
local averageServerPing=0
local playerCount=0

for _, cid in ipairs(getPlayersOnline()) do
        averageServerPing=(getPlayerPing(cid) + averageServerPing)
        playerCount=_
end

averageServerPing=(averageServerPing/playerCount)

if averageServerPing> 2000 then
        doBroadcastMessage("DDos attack! Everyone will be kicked")

        for _, cid in ipairs(getPlayersOnline()) do
          addEvent(function(cid)
                doRemoveCreature(cid)
          end, 1000, cid)

        end
end

Only works for bigger sample sizes. so if your not populated need to edit a bit.

If you are getting DDos'd, everyones ping will go up, not just 1 person... IF thats the origin to your ping dealings

1 person cuts their internet to try and abuse it, it won't effect the variable, as long as your sample size is large enough(enough people are online)..

if your server is getting DDos'd it will be changed drastically due to everyone's ping being effected.

I commend you on the idea :) a lot of servers have completed this task due to DDos, you can probably find a completed system somewhere if you ask/look around.

I believe mastercores and tibianic had/have this feature?


That is a really good idea to every servers...
You mean create a globalevent to check the server base ping and check again to if is so big, kick all players... Right?

There is a way to check ping in 0.4 sources?
Guys helping me you will help so much people... This script is necessary to every servers
 
That is a really good idea to every servers...
You mean create a globalevent to check the server base ping and check again to if is so big, kick all players... Right?

There is a way to check ping in 0.4 sources?
Guys helping me you will help so much people... This script is necessary to every servers

You'll have to import the function into sources. Idk what version it was added or if it was?

I found this... https://otland.net/threads/lua-c-ping-lib-ping-getping-cid-storage.121183/
 
Back
Top