MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / ProcessCommandTarget

Method ProcessCommandTarget

extensions/tf2/extension.cpp:274–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272}
273
274bool TF2Tools::ProcessCommandTarget(cmd_target_info_t *info)
275{
276 int max_clients;
277 IPlayerInfo *pInfo;
278 unsigned int team_index = 0;
279 IGamePlayer *pPlayer, *pAdmin;
280
281 if ((info->flags & COMMAND_FILTER_NO_MULTI) == COMMAND_FILTER_NO_MULTI)
282 {
283 return false;
284 }
285
286 if (info->admin)
287 {
288 if ((pAdmin = playerhelpers->GetGamePlayer(info->admin)) == NULL)
289 {
290 return false;
291 }
292 if (!pAdmin->IsInGame())
293 {
294 return false;
295 }
296 }
297 else
298 {
299 pAdmin = NULL;
300 }
301
302 if (strcmp(info->pattern, "@red") == 0 )
303 {
304 team_index = 2;
305 }
306 else if (strcmp(info->pattern, "@blue") == 0)
307 {
308 team_index = 3;
309 }
310 else
311 {
312 return false;
313 }
314
315 info->num_targets = 0;
316
317 max_clients = playerhelpers->GetMaxClients();
318 for (int i = 1;
319 i <= max_clients && (cell_t)info->num_targets < info->max_targets;
320 i++)
321 {
322 if ((pPlayer = playerhelpers->GetGamePlayer(i)) == NULL)
323 {
324 continue;
325 }
326 if (!pPlayer->IsInGame())
327 {
328 continue;
329 }
330 if ((pInfo = pPlayer->GetPlayerInfo()) == NULL)
331 {

Callers

nothing calls this directly

Calls 7

GetGamePlayerMethod · 0.80
IsInGameMethod · 0.80
GetMaxClientsMethod · 0.80
GetPlayerInfoMethod · 0.80
GetTeamIndexMethod · 0.80
FilterCommandTargetMethod · 0.80
UTIL_FormatFunction · 0.70

Tested by

no test coverage detected