diff options
author | IronClawTrem <louie.nutman@gmail.com> | 2020-02-22 19:36:19 +0000 |
---|---|---|
committer | IronClawTrem <louie.nutman@gmail.com> | 2020-02-22 19:36:19 +0000 |
commit | 939542a6286c4c5983e4e4ea3639a79e2f584481 (patch) | |
tree | 571ef9857ccda19fde292f6390987c335264c325 | |
parent | 09c8ff57b88755f557bab5cb1aa5168fb6d78cb2 (diff) |
add !drug command
-rw-r--r-- | src/game/g_admin.c | 50 | ||||
-rw-r--r-- | src/game/g_admin.h | 1 |
2 files changed, 51 insertions, 0 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c index 7b62341..1a73536 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -436,6 +436,11 @@ g_admin_cmd_t g_admin_cmds[ ] = {"switch", G_admin_switch, "switch", "switch places with somenone", "[^3name|slot#^7]" + }, + + {"drug", G_admin_drug, "drug", + "induce a gas like effect on a player", + "[^3name|slot#^7]" } }; @@ -8499,3 +8504,48 @@ qboolean G_admin_switch( gentity_t *ent, int skiparg ) return qtrue; } + +qboolean G_admin_drug( gentity_t *ent, int skiparg ) +{ + int pids[ MAX_CLIENTS ], found; + char name[ MAX_NAME_LENGTH ], err[ MAX_STRING_CHARS ]; + int minargc; + gentity_t *vic; + + minargc = 2 + skiparg; + + if( G_SayArgc() < minargc ) + { + ADMP( "^3!drug: ^7usage: !drug [name|slot#]\n" ); + return qfalse; + } + + G_SayArgv( 1 + skiparg, name, sizeof( name ) ); + + if( G_ClientNumbersFromString( name, pids ) != 1 ) + { + G_MatchOnePlayer( pids, err, sizeof( err ) ); + ADMP( va( "^3!drug: ^7%s\n", err ) ); + return qfalse; + } + + vic = &g_entities[ pids[ 0 ] ]; + + if( !admin_higher( ent, &g_entities[ pids[ 0 ] ] ) ) + { + ADMP( "^3!drug: ^7sorry, but that player has a higher admin" + " level than you\n" ); + return qfalse; + } + + vic->client->ps.stats[ STAT_STATE ] |= SS_POISONCLOUDED; + vic->client->lastPoisonCloudedTime = level.time; + trap_SendServerCommand( vic->client->ps.clientNum, "poisoncloud" ); + + AP( va( "print \"^3!drug: ^7%s ^7was drugged by %s^7\n\"", + vic->client->pers.netname, + ( ent ) ? G_admin_adminPrintName( ent ) : "console" ) ); + + return qtrue; + +} diff --git a/src/game/g_admin.h b/src/game/g_admin.h index b0e1cd5..877f286 100644 --- a/src/game/g_admin.h +++ b/src/game/g_admin.h @@ -308,6 +308,7 @@ void G_admin_schachtmeisterFrame( void ); qboolean G_admin_is_restricted(gentity_t *ent, qboolean sendMessage); qboolean G_admin_print2( gentity_t *ent, int skiparg ); qboolean G_admin_switch( gentity_t *ent, int skiparg ); +qboolean G_admin_drug( gentity_t *ent, int skiparg ); void G_admin_print( gentity_t *ent, char *m ); void G_admin_buffer_print( gentity_t *ent, char *m ); |