Add support for auto-converting '_' to ':' with Steam3 Id targetting
This commit is contained in:
parent
215bbb8324
commit
29d428adc2
@ -1556,28 +1556,34 @@ void PlayerManager::ProcessCommandTarget(cmd_target_info_t *info)
|
|||||||
|
|
||||||
if (steamIdType > 0)
|
if (steamIdType > 0)
|
||||||
{
|
{
|
||||||
const char *search_pattern;
|
char new_pattern[256];
|
||||||
char tmp_pattern[256];
|
|
||||||
if (steamIdType == 2)
|
if (steamIdType == 2)
|
||||||
{
|
{
|
||||||
size_t p, len;
|
size_t p, len;
|
||||||
|
|
||||||
strcpy(tmp_pattern, "STEAM_");
|
strcpy(new_pattern, "STEAM_");
|
||||||
len = strlen(&info->pattern[7]);
|
len = strlen(&info->pattern[7]);
|
||||||
for (p = 0; p < len; p++)
|
for (p = 0; p < len; p++)
|
||||||
{
|
{
|
||||||
tmp_pattern[6 + p] = info->pattern[7 + p];
|
new_pattern[6 + p] = info->pattern[7 + p];
|
||||||
if (tmp_pattern[6 + p] == '_')
|
if (new_pattern[6 + p] == '_')
|
||||||
{
|
{
|
||||||
tmp_pattern[6 + p] = ':';
|
new_pattern[6 + p] = ':';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tmp_pattern[6 + p] = '\0';
|
new_pattern[6 + p] = '\0';
|
||||||
search_pattern = tmp_pattern;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
search_pattern = &info->pattern[1];
|
size_t p = 0;
|
||||||
|
char c;
|
||||||
|
while ((c = info->pattern[p + 1]) != '\0')
|
||||||
|
{
|
||||||
|
new_pattern[p] = (c == '_') ? ':' : c;
|
||||||
|
++p;
|
||||||
|
}
|
||||||
|
|
||||||
|
new_pattern[p] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 1; i <= max_clients; i++)
|
for (int i = 1; i <= max_clients; i++)
|
||||||
@ -1593,7 +1599,7 @@ void PlayerManager::ProcessCommandTarget(cmd_target_info_t *info)
|
|||||||
|
|
||||||
// We want to make it easy for people to be kicked/banned, so don't require validation for command targets.
|
// We want to make it easy for people to be kicked/banned, so don't require validation for command targets.
|
||||||
const char *steamId = steamIdType == 2 ? pTarget->GetSteam2Id(false) : pTarget->GetSteam3Id(false);
|
const char *steamId = steamIdType == 2 ? pTarget->GetSteam2Id(false) : pTarget->GetSteam3Id(false);
|
||||||
if (steamId && strcmp(steamId, search_pattern) == 0)
|
if (steamId && strcmp(steamId, new_pattern) == 0)
|
||||||
{
|
{
|
||||||
if ((info->reason = FilterCommandTarget(pAdmin, pTarget, info->flags))
|
if ((info->reason = FilterCommandTarget(pAdmin, pTarget, info->flags))
|
||||||
== COMMAND_TARGET_VALID)
|
== COMMAND_TARGET_VALID)
|
||||||
|
Loading…
Reference in New Issue
Block a user