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

Method ProcessCommandTarget

core/PlayerManager.cpp:1585–1910  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1583}
1584
1585void PlayerManager::ProcessCommandTarget(cmd_target_info_t *info)
1586{
1587 CPlayer *pTarget, *pAdmin;
1588 int max_clients, total = 0;
1589
1590 max_clients = GetMaxClients();
1591
1592 if (info->max_targets < 1)
1593 {
1594 info->reason = COMMAND_TARGET_NONE;
1595 info->num_targets = 0;
1596 }
1597
1598 if (info->admin == 0)
1599 {
1600 pAdmin = NULL;
1601 }
1602 else
1603 {
1604 pAdmin = GetPlayerByIndex(info->admin);
1605 }
1606
1607 if (info->pattern[0] == '#')
1608 {
1609 int userid = atoi(&info->pattern[1]);
1610 int client = GetClientOfUserId(userid);
1611
1612 /* See if a valid userid matched */
1613 if (client > 0)
1614 {
1615 IGamePlayer *pTarget = GetPlayerByIndex(client);
1616 if (pTarget != NULL)
1617 {
1618 if ((info->reason = FilterCommandTarget(pAdmin, pTarget, info->flags)) == COMMAND_TARGET_VALID)
1619 {
1620 info->targets[0] = client;
1621 info->num_targets = 1;
1622 ke::SafeStrcpy(info->target_name, info->target_name_maxlength, pTarget->GetName());
1623 info->target_name_style = COMMAND_TARGETNAME_RAW;
1624 }
1625 else
1626 {
1627 info->num_targets = 0;
1628 }
1629 return;
1630 }
1631 }
1632
1633 /* Do we need to look for a steam id? */
1634 int steamIdType = 0;
1635 if (strncmp(&info->pattern[1], "STEAM_", 6) == 0)
1636 {
1637 steamIdType = 2;
1638 }
1639 else if (strncmp(&info->pattern[1], "[U:", 3) == 0)
1640 {
1641 steamIdType = 3;
1642 }

Callers

nothing calls this directly

Calls 8

GetClientOfUserIdFunction · 0.85
IsConnectedMethod · 0.80
GetSteam2IdMethod · 0.80
GetSteam3IdMethod · 0.80
IsFakeClientMethod · 0.80
GetNameMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected