All pastes #908841 Raw Edit

Mine

public c v1 · immutable
·published 2008-02-18 19:39 UTC
rendered paste body
qboolean G_admin_detonate( gentity_t *ent, int skiparg ){  int pids[ MAX_CLIENTS ];  int oldhealth, damage = 0;  char name[ MAX_NAME_LENGTH ], err[ MAX_STRING_CHARS ];  char command[ MAX_ADMIN_CMD_LEN ], *cmd;  gentity_t *vic;  gentity_t *tent;  if( G_SayArgc() < 2 + skiparg )  {    ADMP( "^3!detonate: ^7usage: !detonate: [name|slot#]\n" );    return qfalse;  }  G_SayArgv( skiparg, command, sizeof( command ) );  cmd = command;  if( cmd && *cmd == '!' )    cmd++;  G_SayArgv( 1 + skiparg, name, sizeof( name ) );  if( ( G_ClientNumbersFromString( name, pids ) ) != 1 )  {    G_MatchOnePlayer( pids, err, sizeof( err ) );    ADMP( va( "^3!detonate: ^7%s\n", err ) );    return qfalse;  }  if( !admin_higher( ent, &g_entities[ pids[ 0 ] ] ) )  {    ADMP( "^3!detonate: ^7sorry, but your intended victim has a higher admin"        " level than you\n" );    return qfalse;  }  vic = &g_entities[ pids[ 0 ] ];  if( vic->client->pers.teamSelection == PTE_NONE ||      vic->client->pers.classSelection == PCL_NONE || vic->client->ps.pm_flags & PMF_QUEUED ) {    ADMP( "^3!detonate: ^7can't detonate: a ghost\n" );    return qfalse;  }    //make them explode...	tent = G_TempEntity( vic->s.origin, EV_HUMAN_BUILDABLE_EXPLOSION );	oldhealth = vic->health;	damage = BG_FindHealthForClass( vic->client->ps.stats[ STAT_PCLASS ] );	vic->health -= damage;	vic->client->ps.stats[ STAT_HEALTH ] = vic->health;	vic->lastDamageTime = level.time;	if( vic->health <= 0 )	{		vic->enemy = ent;		vic->die( vic, ent, ent, damage, MOD_KILL );	}	CPx( pids[ 0 ], "cp \"^1You've been detonated!\"" );	AP( va( "print \"^3!detonate: ^7%s^7 was detonated by ^7%s\n\"",					vic->client->pers.netname,					( ent ) ? ent->client->pers.netname : "console" ) );  //ClientUserinfoChanged( pids[ 0 ] );  return qtrue;}