diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/g_admin.c | 18 | ||||
-rw-r--r-- | src/game/g_client.c | 16 | ||||
-rw-r--r-- | src/game/g_local.h | 3 | ||||
-rw-r--r-- | src/game/g_namelog.c | 1 |
4 files changed, 32 insertions, 6 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c index 372891e7..2f92d5c2 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -1428,6 +1428,12 @@ qboolean G_admin_setlevel( gentity_t *ent ) return qfalse; } + if( vic && vic->client->pers.guidless ) + { + ADMP( va( "^3setlevel: ^7%s^7 has no GUID\n", vic->client->pers.netname ) ); + return qfalse; + } + if( !a && vic ) { for( a = g_admin_admins; a && a->next; a = a->next ); @@ -1645,7 +1651,7 @@ qboolean G_admin_kick( gentity_t *ent ) reason ) ); admin_create_ban( ent, vic->client->pers.netname, - vic->client->pers.guid, + vic->client->pers.guidless ? "" : vic->client->pers.guid, &vic->client->pers.ip, MAX( 1, G_admin_parse_time( g_adminTempBan.string ) ), ( *reason ) ? reason : "kicked by admin" ); @@ -1834,7 +1840,7 @@ qboolean G_admin_ban( gentity_t *ent ) match->slot == -1 ? match->name[ match->nameOffset ] : level.clients[ match->slot ].pers.netname, - match->guid, + match->guidless ? "" : match->guid, &ip, seconds, reason ); } @@ -1853,7 +1859,7 @@ qboolean G_admin_ban( gentity_t *ent ) match->slot == -1 ? match->name[ match->nameOffset ] : level.clients[ match->slot ].pers.netname, - match->guid, + match->guidless ? "" : match->guid, &match->ip[ i ], seconds, reason ); admin_log( va( "[%s]", match->ip[ i ].str ) ); @@ -2420,12 +2426,12 @@ qboolean G_admin_listplayers( gentity_t *ent ) colorlen += 2; } - ADMBP( va( "%2i ^%c%c^7 %-2i^2%c^7 %*s^7 ^1%c%c^7 %s^7 %s%s%s\n", + ADMBP( va( "%2i ^%c%c %s %s^7 %*s^7 ^1%c%c^7 %s^7 %s%s%s\n", i, c, t, - l ? l->level : 0, - hint ? '*' : ' ', + p->pers.guidless ? "^1---" : va( "^7%-2i^2%c", l ? l->level : 0, hint ? '*' : ' ' ), + p->pers.alternateProtocol == 2 ? "^11" : p->pers.alternateProtocol == 1 ? "^3G" : " ", admin_level_maxname + colorlen, lname, muted, diff --git a/src/game/g_client.c b/src/game/g_client.c index 99f928cf..7ddd00ec 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1064,6 +1064,22 @@ char *ClientConnect( int clientNum, qboolean firstTime ) client->pers.admin = G_admin_admin( client->pers.guid ); + client->pers.alternateProtocol = trap_Cvar_VariableIntegerValue( va( "sv_clAltProto%i", clientNum ) ); + + if( client->pers.alternateProtocol == 2 && client->pers.guid[ 0 ] == '\0' ) + { + size_t len = strlen( client->pers.ip.str ); + if( len == 0 ) + len = 1; + for( i = 0; i < sizeof( client->pers.guid ) - 1; ++i ) + { + int j = client->pers.ip.str[ i % len ] + rand() / ( RAND_MAX / 16 + 1 ); + client->pers.guid[ i ] = "0123456789ABCDEF"[ j % 16 ]; + } + client->pers.guid[ sizeof( client->pers.guid ) - 1 ] = '\0'; + client->pers.guidless = qtrue; + } + // check for admin ban if( G_admin_ban_check( ent, reason, sizeof( reason ) ) ) { diff --git a/src/game/g_local.h b/src/game/g_local.h index 35fafb69..b6d65c78 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -264,6 +264,7 @@ typedef struct namelog_s char name[ MAX_NAMELOG_NAMES ][ MAX_NAME_LENGTH ]; addr_t ip[ MAX_NAMELOG_ADDRS ]; char guid[ 33 ]; + qboolean guidless; int slot; qboolean banned; @@ -322,7 +323,9 @@ typedef struct int floodTime; vec3_t lastDeathLocation; + int alternateProtocol; char guid[ 33 ]; + qboolean guidless; addr_t ip; char voice[ MAX_VOICE_NAME_LEN ]; qboolean useUnlagged; diff --git a/src/game/g_namelog.c b/src/game/g_namelog.c index 66136844..6655c2c4 100644 --- a/src/game/g_namelog.c +++ b/src/game/g_namelog.c @@ -50,6 +50,7 @@ void G_namelog_connect( gclient_t *client ) { n = BG_Alloc( sizeof( namelog_t ) ); strcpy( n->guid, client->pers.guid ); + n->guidless = client->pers.guidless; if( p ) { p->next = n; |