• 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++ Compile 0.4 with ping function getting errors

warriorfrog

Active Member
Joined
Jul 29, 2015
Messages
334
Reaction score
35
To use the script: GlobalEvent - Auto kick lagged players + DDoS protection (https://otland.net/threads/auto-kick-lagged-players-ddos-protection.121492/#post-1187916)
You need the lib: [Lua & C++] Ping lib -- ping.getPing(cid,storage) (https://otland.net/threads/lua-c-ping-lib-ping-getping-cid-storage.121183/)

And to you use the lib, need this C++ code:

But it's for 0.3.6, and i'm using 0.4

I found this guy converting to 0.4

Tried to use, but now its broke my source code and idk C++

So i tried this:
luascript.cpp

luascript.h

But got this errors:
Code:
luascript.cpp:7393:2: error: stray ‘\357’ in program
{��
  ^
luascript.cpp:7393:3: error: stray ‘\273’ in program
{��
   ^
luascript.cpp:7393:4: error: stray ‘\277’ in program
{�
    ^
luascript.cpp:7395:22: error: stray ‘\357’ in program
     ScriptEnviroment*�� env = getEnv();
                      ^
luascript.cpp:7395:23: error: stray ‘\273’ in program
     ScriptEnviroment*�� env = getEnv();
                       ^
luascript.cpp:7395:24: error: stray ‘\277’ in program
     ScriptEnviroment*� env = getEnv();
                        ^
luascript.cpp:7403:23: error: stray ‘\357’ in program
     player->lastPing =�� timeNow;
                       ^
luascript.cpp:7403:24: error: stray ‘\273’ in program
     player->lastPing =�� timeNow;
                        ^
luascript.cpp:7403:25: error: stray ‘\277’ in program
     player->lastPing =� timeNow;
                         ^
luascript.cpp:7403:26: error: stray ‘\357’ in program
     player->lastPing =�� timeNow;
                          ^
luascript.cpp:7403:27: error: stray ‘\273’ in program
     player->lastPing =�� timeNow;
                           ^
luascript.cpp:7403:28: error: stray ‘\277’ in program
     player->lastPing =� timeNow;
                            ^
luascript.cpp:7404:23: error: stray ‘\357’ in program
     if(player->client)��
                       ^
luascript.cpp:7404:24: error: stray ‘\273’ in program
     if(player->client)��
                        ^
luascript.cpp:7404:25: error: stray ‘\277’ in program
     if(player->client)�
                         ^
luascript.cpp:7407:24: error: stray ‘\357’ in program
             lua_pushboo��lean(L, true);
                        ^
luascript.cpp:7407:25: error: stray ‘\273’ in program
             lua_pushboo��lean(L, true);
                         ^
luascript.cpp:7407:26: error: stray ‘\277’ in program
             lua_pushboo�lean(L, true);
                          ^
luascript.cpp:7419:14: error: stray ‘\357’ in program
     return 1;��
              ^
luascript.cpp:7419:15: error: stray ‘\273’ in program
     return 1;��
               ^
luascript.cpp:7419:16: error: stray ‘\277’ in program
     return 1;�
                ^
luascript.cpp:7427:6: error: stray ‘\357’ in program
     {��
      ^
luascript.cpp:7427:7: error: stray ‘\273’ in program
     {��
       ^
luascript.cpp:7427:8: error: stray ‘\277’ in program
     {�
        ^
luascript.cpp:7429:24: error: stray ‘\357’ in program
          lua_pushboolea��n(L, false);
                        ^
luascript.cpp:7429:25: error: stray ‘\273’ in program
          lua_pushboolea��n(L, false);
                         ^
luascript.cpp:7429:26: error: stray ‘\277’ in program
          lua_pushboolea�n(L, false);
                          ^
luascript.cpp:7445:18: error: stray ‘\357’ in program
         return 1;��
                  ^
luascript.cpp:7445:19: error: stray ‘\273’ in program
         return 1;��
                   ^
luascript.cpp:7445:20: error: stray ‘\277’ in program
         return 1;�
                    ^
luascript.cpp:7446:6: error: stray ‘\357’ in program
     }��
      ^
luascript.cpp:7446:7: error: stray ‘\273’ in program
     }��
       ^
luascript.cpp:7446:8: error: stray ‘\277’ in program
     }�
        ^
luascript.cpp:7446:9: error: stray ‘\357’ in program
     }��
         ^
luascript.cpp:7446:10: error: stray ‘\273’ in program
     }��
          ^
luascript.cpp:7446:11: error: stray ‘\277’ in program
     }�
           ^
luascript.cpp:7447:30: error: stray ‘\357’ in program
     lua_pushnumber(L, player-��>lastPong);
                              ^
luascript.cpp:7447:31: error: stray ‘\273’ in program
     lua_pushnumber(L, player-��>lastPong);
                               ^
luascript.cpp:7447:32: error: stray ‘\277’ in program
     lua_pushnumber(L, player-�>lastPong);
                                ^
luascript.cpp: In static member function ‘static int32_t LuaInterface::luaDoPlayerSendPing(lua_State*)’:
luascript.cpp:7407:13: error: ‘lua_pushboo’ was not declared in this scope
             lua_pushboolean(L, true);
             ^~~~~~~~~~~
luascript.cpp: In static member function ‘static int32_t LuaInterface::luaGetPlayerLastPing(lua_State*)’:
luascript.cpp:7429:10: error: ‘lua_pushboolea’ was not declared in this scope
          lua_pushboolean(L, false);
          ^~~~~~~~~~~~~~
luascript.cpp:7432:13: warning: unused variable ‘timeNow’ [-Wunused-variable]
     int64_t timeNow = OTSYS_TIME();
             ^~~~~~~
luascript.cpp: In static member function ‘static int32_t LuaInterface::luaGetPlayerLastPong(lua_State*)’:
luascript.cpp:7447:33: error: expected primary-expression before ‘>’ token
     lua_pushnumber(L, player->lastPong);
                                 ^
luascript.cpp:7447:34: error: ‘lastPong’ was not declared in this scope
     lua_pushnumber(L, player->lastPong);
                                  ^~~~~~~~
Makefile:33: recipe for target 'luascript.o' failed
 
Back
Top