aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/chatcommand.cpp
diff options
context:
space:
mode:
authorTom Barham <me@cpdt.dev>2022-02-22 08:33:53 +1000
committerGitHub <noreply@github.com>2022-02-21 19:33:53 -0300
commit8c9f34283f8670dda98959d0785d682e6f652a93 (patch)
tree5e9d8c10fb5d1df2816fac43e4db3b80cc7f93a0 /NorthstarDedicatedTest/chatcommand.cpp
parentae9df9bc734c6c0364028c71db5e7236e7c344dd (diff)
downloadNorthstarLauncher-8c9f34283f8670dda98959d0785d682e6f652a93.tar.gz
NorthstarLauncher-8c9f34283f8670dda98959d0785d682e6f652a93.zip
Advanced chat: custom messages and client hooks (#74)
Co-authored-by: Emma Miler <27428383+emma-miler@users.noreply.github.com>
Diffstat (limited to 'NorthstarDedicatedTest/chatcommand.cpp')
-rw-r--r--NorthstarDedicatedTest/chatcommand.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/NorthstarDedicatedTest/chatcommand.cpp b/NorthstarDedicatedTest/chatcommand.cpp
index 0540a9a0..cd6a998c 100644
--- a/NorthstarDedicatedTest/chatcommand.cpp
+++ b/NorthstarDedicatedTest/chatcommand.cpp
@@ -2,6 +2,7 @@
#include "chatcommand.h"
#include "concommand.h"
#include "dedicated.h"
+#include "localchatwriter.h"
// note: isIngameChat is an int64 because the whole register the arg is stored in needs to be 0'd out to work
// if isIngameChat is false, we use network chat instead
@@ -20,6 +21,14 @@ void ConCommand_say_team(const CCommand& args)
ClientSayText(nullptr, args.ArgS(), true, true);
}
+void ConCommand_log(const CCommand& args)
+{
+ if (args.ArgC() >= 2)
+ {
+ LocalChatWriter(LocalChatWriter::GameContext).WriteLine(args.ArgS());
+ }
+}
+
void InitialiseChatCommands(HMODULE baseAddress)
{
if (IsDedicated())
@@ -28,4 +37,5 @@ void InitialiseChatCommands(HMODULE baseAddress)
ClientSayText = (ClientSayTextType)((char*)baseAddress + 0x54780);
RegisterConCommand("say", ConCommand_say, "Enters a message in public chat", FCVAR_CLIENTDLL);
RegisterConCommand("say_team", ConCommand_say_team, "Enters a message in team chat", FCVAR_CLIENTDLL);
-} \ No newline at end of file
+ RegisterConCommand("log", ConCommand_log, "Log a message to the local chat window", FCVAR_CLIENTDLL);
+}