Add some more improvements to namesteal

This commit is contained in:
BenCat07 2021-08-03 00:56:23 +02:00 committed by LightCat
parent 16cd633b9c
commit 01ef882870
2 changed files with 10 additions and 6 deletions

View File

@ -27,11 +27,13 @@
<Option name="Active" value="2"/>
</Select>
</LabeledObject>
<AutoVariable width="fill" target="name.namesteal.reconnect" label="Namesteal Reconnect"/>
<AutoVariable width="fill" target="name.namesteal.reconnect" label="Namesteal reconnect"/>
<AutoVariable width="fill" target="name.namesteal.use-newlines" label="Namesteal newlines" tooltip="Use glitchy newlines, will make your name invisible."/>
<AutoVariable width="fill" target="name.namesteal.steamid-zero" label="Invisible avatar" tooltip="Use a steamid of 0, will make your avatar invisible."/>
<AutoVariable width="fill" target="misc.random-name" label="Random name"/>
</List>
</Box>
<Box height="content" width="content" padding="12 6 6 6" name="Extra" x="215" y="75">
<Box height="content" width="content" padding="12 6 6 6" name="Extra" x="215" y="115">
<List width="200">
<AutoVariable width="fill" target="noisemaker-spam.enable" label="Noisemaker spam"/>
<AutoVariable width="fill" target="player-tools.betrayal-limit" label="Betrayal limit"/>

View File

@ -13,6 +13,8 @@ settings::String force_name{ "name.custom", "" };
std::string name_forced = "";
static settings::Int namesteal{ "name.namesteal", "0" };
static settings::Boolean namesteal_reconnect("name.namesteal.reconnect", "true");
static settings::Boolean glitchy_newlines("name.namesteal.use-newlines", "false");
static settings::Boolean use_steamidzero("name.namesteal.steamid-zero", "false");
static std::string stolen_name;
static unsigned stolen_target;
@ -53,7 +55,7 @@ bool StolenName()
if (!player_tools::shouldTargetSteamId(info.friendsID))
continue;
// Invisible character won't fit into name with max. length
if (std::strlen(info.name) >= 31)
if (std::strlen(info.name) >= 29)
continue;
// Ignore Friendly
if (!player_tools::shouldTargetSteamId(info.friendsID))
@ -93,7 +95,7 @@ bool StolenName()
// If our name is the same as current, than change it and return true
stolen_name = std::string(info.name);
stolen_target = info.friendsID;
hacks::tf2::steamidstealer::SetSteamID(hacks::tf2::steamidstealer::IDStorage(stolen_target, "namestealer"));
hacks::tf2::steamidstealer::SetSteamID(hacks::tf2::steamidstealer::IDStorage(use_steamidzero ? 0 : stolen_target, "namestealer"));
return true;
}
@ -127,10 +129,10 @@ std::string GetNamestealName(CSteamID steam_id)
if (stolen_name != "")
// Return the name that has changed from the func above
return format(stolen_name, "\e");
return format(stolen_name, glitchy_newlines ? "\n\n\n" : "\u2063");
}
else if (stolen_name != "")
return format(stolen_name, "\e");
return format(stolen_name, glitchy_newlines ? "\n\n\n" : "\u2063");
}
#if ENABLE_IPC