From e984293788358a72dcb57ad5d74402a3f10f0d97 Mon Sep 17 00:00:00 2001 From: /dev/humancontroller Date: Thu, 6 Apr 2017 20:39:29 +0200 Subject: implement Schachtmeister v2 basics --- src/game/g_admin.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/game/g_admin.h | 1 + src/game/g_svcmds.c | 6 ++++++ 3 files changed, 60 insertions(+) (limited to 'src/game') diff --git a/src/game/g_admin.c b/src/game/g_admin.c index 49aa46da..41490814 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -214,6 +214,11 @@ g_admin_cmd_t g_admin_cmds[ ] = "(^5name|IP(/mask)^7) (^5start at ban#^7)" }, + {"sm", G_admin_sm, qfalse, "schachtmeister", + "Schachtmeister", + "..." + }, + {"spec999", G_admin_spec999, qfalse, "spec999", "move 999 pingers to the spectator team", ""}, @@ -1669,6 +1674,54 @@ qboolean G_admin_setdisabled( gentity_t *ent ) return qtrue; } +qboolean G_admin_sm( gentity_t *ent ) +{ + const char *s; + char feature[ 16 ]; + + if( trap_Argc() < 2 ) + { + usage: + ADMP( "^3sm: ^7usage: sm ipa \n" ); + return qfalse; + } + + s = ConcatArgs( 1 ); + if( strchr( s, '\n' ) || strchr( s, '\r' ) ) + { + ADMP( "^3sm: ^7invalid character\n" ); + return qfalse; + } + + trap_Argv( 1, feature, sizeof( feature ) ); + + if( !Q_stricmp( feature, "ipa" ) ) + { + char ipa[ 32 ]; + + if( trap_Argc() > 3 ) + { + ADMP( "^3sm: ^7excessive arguments\n" ); + goto usage; + } + trap_Argv( 2, ipa, sizeof( ipa ) ); + + if( rand() % 2 /* FIXME cache hit */ ) + { + const char *answer = "interesting"; + ADMP( va( "^3sm: ^7IP address '%s^7' is: %s\n", ipa, answer ) ); + return qtrue; + } + + ADMP( "^3sm: ^7hmm...\n" ); + trap_SendConsoleCommand( EXEC_APPEND, va( "smq ipa \"%s\"\n", ipa ) ); + } + else + goto usage; + + return qtrue; +} + qboolean G_admin_kick( gentity_t *ent ) { int pid; diff --git a/src/game/g_admin.h b/src/game/g_admin.h index 10727bd3..a93ae058 100644 --- a/src/game/g_admin.h +++ b/src/game/g_admin.h @@ -187,6 +187,7 @@ qboolean G_admin_buildlog( gentity_t *ent ); qboolean G_admin_revert( gentity_t *ent ); qboolean G_admin_setdevmode( gentity_t *ent ); qboolean G_admin_setdisabled( gentity_t *ent ); +qboolean G_admin_sm( gentity_t *ent ); void G_admin_print( gentity_t *ent, char *m ); void G_admin_buffer_print( gentity_t *ent, char *m ); diff --git a/src/game/g_svcmds.c b/src/game/g_svcmds.c index eaeea0c7..f36afb96 100644 --- a/src/game/g_svcmds.c +++ b/src/game/g_svcmds.c @@ -164,6 +164,11 @@ static void Svcmd_Status_f( void ) } } +static void Svcmd_SMR_f( void ) +{ + G_Printf( "unrecognized Schachtmeister response: %s\n", ConcatArgs( 1 ) ); +} + /* =================== Svcmd_ForceTeam_f @@ -579,6 +584,7 @@ struct svcmd { "printqueue", qfalse, Svcmd_PrintQueue_f }, { "say", qtrue, Svcmd_MessageWrapper }, { "say_team", qtrue, Svcmd_TeamMessage_f }, + { "smr", qfalse, Svcmd_SMR_f }, { "status", qfalse, Svcmd_Status_f }, { "stopMapRotation", qfalse, G_StopMapRotation }, { "suddendeath", qfalse, Svcmd_SuddenDeath_f } -- cgit