MCPcopy Create free account
hub / github.com/JACoders/OpenJK / NPC_Kill_f

Function NPC_Kill_f

code/game/NPC_spawn.cpp:4186–4329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4184*/
4185
4186void NPC_Kill_f( void )
4187{
4188 int n;
4189 gentity_t *player;
4190 char *name;
4191 team_t killTeam = TEAM_FREE;
4192 qboolean killNonSF = qfalse;
4193
4194 name = gi.argv( 2 );
4195
4196 if ( !*name || !name[0] )
4197 {
4198 gi.Printf( S_COLOR_RED"Error, Expected:\n");
4199 gi.Printf( S_COLOR_RED"NPC kill '[NPC targetname]' - kills NPCs with certain targetname\n" );
4200 gi.Printf( S_COLOR_RED"or\n" );
4201 gi.Printf( S_COLOR_RED"NPC kill 'all' - kills all NPCs\n" );
4202 gi.Printf( S_COLOR_RED"or\n" );
4203 gi.Printf( S_COLOR_RED"NPC team '[teamname]' - kills all NPCs of a certain team ('nonally' is all but your allies)\n" );
4204 return;
4205 }
4206
4207 if ( Q_stricmp( "team", name ) == 0 )
4208 {
4209 name = gi.argv( 3 );
4210
4211 if ( !*name || !name[0] )
4212 {
4213 gi.Printf( S_COLOR_RED"NPC_Kill Error: 'npc kill team' requires a team name!\n" );
4214 gi.Printf( S_COLOR_RED"Valid team names are:\n");
4215 for ( n = (TEAM_FREE + 1); n < TEAM_NUM_TEAMS; n++ )
4216 {
4217 gi.Printf( S_COLOR_RED"%s\n", GetStringForID( TeamTable, n ) );
4218 }
4219 gi.Printf( S_COLOR_RED"nonally - kills all but your teammates\n" );
4220 return;
4221 }
4222
4223 if ( Q_stricmp( "nonally", name ) == 0 )
4224 {
4225 killNonSF = qtrue;
4226 }
4227 else
4228 {
4229 killTeam = (team_t)GetIDForString( TeamTable, name );
4230
4231 if ( killTeam == (team_t)-1 )
4232 {
4233 gi.Printf( S_COLOR_RED"NPC_Kill Error: team '%s' not recognized\n", name );
4234 gi.Printf( S_COLOR_RED"Valid team names are:\n");
4235 for ( n = (TEAM_FREE + 1); n < TEAM_NUM_TEAMS; n++ )
4236 {
4237 gi.Printf( S_COLOR_RED"%s\n", GetStringForID( TeamTable, n ) );
4238 }
4239 gi.Printf( S_COLOR_RED"nonally - kills all but your teammates\n" );
4240 return;
4241 }
4242 }
4243 }

Callers 1

Svcmd_NPC_fFunction · 0.70

Calls 5

Q_stricmpFunction · 0.85
GEntity_DieFuncFunction · 0.70
G_FreeEntityFunction · 0.70
GetStringForIDFunction · 0.50
GetIDForStringFunction · 0.50

Tested by

no test coverage detected