1

Topic: g_server.cpp and server versions

When I make a change to the hook code in g_server.cpp and try to connect to that server, my client says that the server is the wrong version. Reverse these changes and everything is fine. Why is this?

if($poster["intelligence"] == $intelligence["idiot"])
        deny_post($poster);

2

Re: g_server.cpp and server versions

i don't think a change in gs_server.cpp can do that.

btw: i warned you that this will happen in this thread: http://www.teeworlds.com/forum/viewtopi … 715#p15715

scosu wrote:

you can find the hook behaviour in g_game.cpp function player_core::tick. Please download eclipse or something like that and search yourself. It doesn't take too much time. And be careful. g_game.cpp is a file which is included in the construction of the version string. if you don't make the comparison between server and client version static, no client can connect because of wrong version. Also the hook will behave strange because it is calculated client and server-side.

3

Re: g_server.cpp and server versions

How do I make the comparison? I am not sure what you mean by that.

if($poster["intelligence"] == $intelligence["idiot"])
        deny_post($poster);

4

Re: g_server.cpp and server versions

compile client yourself?^^

Remember me? Questions? Just leave a message, I will respond within 72 hrs!

5 (edited by Roanoke 2008-06-24 03:45:02)

Re: g_server.cpp and server versions

Oh, so that's what he meant. That does not work for my purposes. Oh, well, I guess I will skip that feature. sad
Unless I misunderstood and there is another way to circumvent this. Is there? As I understood it, if I change g_game.cpp no client can connect unless they also run my client that I compiled myself, right?

if($poster["intelligence"] == $intelligence["idiot"])
        deny_post($poster);

6

Re: g_server.cpp and server versions

--- teeworlds-0.4.2-src/src/engine/server/es_server.c    2008-04-05 15:13:02.000000000 +0200
+++ teeworlds_improved_physics/src/engine/server/es_server.c    2008-06-04 16:08:48.000000000 +0200
@@ -610,7 +610,7 @@
             char version[64];
             const char *password;
             str_copy(version, msg_unpack_string(), 64);
-            if(strcmp(version, mods_net_version()) != 0)
+            if(strcmp(version, "0.4 1bd7780b0f76307c") != 0)
             {
                 /* OH FUCK! wrong version, drop him */
                 char reason[256];

7

Re: g_server.cpp and server versions

Ah, I see what you mean. So how would I find out the version string for a new teeworlds version?

if($poster["intelligence"] == $intelligence["idiot"])
        deny_post($poster);

8

Re: g_server.cpp and server versions

simply look in the server or client log.

9

Re: g_server.cpp and server versions

Oh, ok. Thanks, a lot for helping, that solves a lot of problems. big_smile

if($poster["intelligence"] == $intelligence["idiot"])
        deny_post($poster);