diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/g_target.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/game/g_target.c b/src/game/g_target.c index 6dacfdf2..c545c299 100644 --- a/src/game/g_target.c +++ b/src/game/g_target.c @@ -63,6 +63,9 @@ The activator is given this many points. */ void Use_Target_Score( gentity_t *ent, gentity_t *other, gentity_t *activator ) { + if( !activator ) + return; + AddScore( activator, ent->count ); } @@ -83,7 +86,7 @@ If "private", only the activator gets the message. If no checks, all clients ge */ void Use_Target_Print( gentity_t *ent, gentity_t *other, gentity_t *activator ) { - if( activator->client && ( ent->spawnflags & 4 ) ) + if( activator && activator->client && ( ent->spawnflags & 4 ) ) { trap_SendServerCommand( activator-g_entities, va( "cp \"%s\"", ent->message ) ); return; @@ -135,7 +138,7 @@ void Use_Target_Speaker( gentity_t *ent, gentity_t *other, gentity_t *activator else { // normal sound - if( ent->spawnflags & 8 ) + if( ent->spawnflags & 8 && activator ) G_AddEvent( activator, EV_GENERAL_SOUND, ent->noise_index ); else if( ent->spawnflags & 4 ) G_AddEvent( ent, EV_GLOBAL_SOUND, ent->noise_index ); @@ -196,7 +199,7 @@ void target_teleporter_use( gentity_t *self, gentity_t *other, gentity_t *activa { gentity_t *dest; - if( !activator->client ) + if( !activator || !activator->client ) return; dest = G_PickTarget( self->target ); @@ -231,11 +234,11 @@ if RANDOM is checked, only one of the targets will be fired, not all of them */ void target_relay_use( gentity_t *self, gentity_t *other, gentity_t *activator ) { - if( ( self->spawnflags & 1 ) && activator->client && + if( ( self->spawnflags & 1 ) && activator && activator->client && activator->client->ps.stats[ STAT_TEAM ] != TEAM_HUMANS ) return; - if( ( self->spawnflags & 2 ) && activator->client && + if( ( self->spawnflags & 2 ) && activator && activator->client && activator->client->ps.stats[ STAT_TEAM ] != TEAM_ALIENS ) return; @@ -266,6 +269,9 @@ Kills the activator. */ void target_kill_use( gentity_t *self, gentity_t *other, gentity_t *activator ) { + if( !activator ) + return; + G_Damage( activator, NULL, NULL, NULL, NULL, 100000, DAMAGE_NO_PROTECTION, MOD_TELEFRAG ); } @@ -448,7 +454,7 @@ target_hurt_use void target_hurt_use( gentity_t *self, gentity_t *other, gentity_t *activator ) { // hurt the activator - if( !activator->takedamage ) + if( !activator || !activator->takedamage ) return; G_Damage( activator, self, self, NULL, NULL, self->damage, 0, MOD_TRIGGER_HURT ); |