diff --git a/src/hooks/PaintTraverse.cpp b/src/hooks/PaintTraverse.cpp index f6e84874..bcfb49d0 100644 --- a/src/hooks/PaintTraverse.cpp +++ b/src/hooks/PaintTraverse.cpp @@ -83,18 +83,6 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) { } } - if (force_name.convar->m_StringLength > 2 && need_name_change) { - INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo(); - if (ch) { - logging::Info("Sending new name"); - NET_SetConVar setname("name", force_name.GetString()); - setname.SetNetChannel(ch); - setname.SetReliable(false); - ch->SendNetMsg(setname, false); - need_name_change = false; - } - } - if (call_default) SAFE_CALL(((PaintTraverse_t*)hooks::hkPanel->GetMethod(hooks::offPaintTraverse))(p, vp, fr, ar)); // To avoid threading problems. diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index ab07173b..64ce6c4d 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -107,7 +107,9 @@ static CatCommand minus_use_action_slot_item_server("-cat_use_action_slot_item_s g_IEngine->ServerCmdKeyValues(kv); }); -static CatVar newlines_msg(CV_INT, "chat_newlines", "0", "Prefix newlines", "Add # newlines before each your message"); +static CatVar newlines_msg(CV_INT, "chat_newlines", "0", "Prefix newlines", "Add # newlines before each your message", 0, 24); +// TODO replace \\n with \n +// TODO name \\n = \n //static CatVar queue_messages(CV_SWITCH, "chat_queue", "0", "Queue messages", "Use this if you want to use spam/killsay and still be able to chat normally (without having your msgs eaten by valve cooldown)"); bool SendNetMsg_hook(void* thisptr, INetMessage& msg, bool bForceReliable = false, bool bVoice = false) { @@ -181,6 +183,22 @@ void FrameStageNotify_hook(void* thisptr, int stage) { } } } + if (stage == FRAME_NET_UPDATE_START) { + if (force_name.convar->m_StringLength > 2 && need_name_change) { + INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo(); + if (ch) { + logging::Info("Sending new name"); + NET_SetConVar setname("name", force_name.GetString()); + setname.SetNetChannel(ch); + setname.SetReliable(false); + ch->SendNetMsg(setname, false); + need_name_change = false; + } + } + static ConVar* name_cv = g_ICvar->FindVar("name"); + name_cv->SetValue(force_name.GetString()); + name_cv->m_pszString = (char*)strfmt("%s", force_name.GetString()); + } if (TF && cathook && !g_Settings.bInvalid && stage == FRAME_RENDER_START) { if (glow_enabled) { for (int i = 0; i < g_GlowObjectManager->m_GlowObjectDefinitions.m_Size; i++) {