aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/chatcommand.cpp
blob: 866a1d7999c067643077bd681b4f3411eacc47fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "pch.h"
#include "chatcommand.h"
#include "concommand.h"

typedef void(__fastcall *ClientSayTextType)(void* a1, const char* message, char unknownAlways1, bool isTeamChat);
ClientSayTextType SayText;

void ConCommand_say(const CCommand& args)
{
	if (args.ArgC() >= 2)
		SayText(nullptr, args.Arg(1), 0, false);
}

void ConCommand_say_team(const CCommand& args)
{
	if (args.ArgC() >= 2)
		SayText(nullptr, args.Arg(1), 0, true);
}

void InitialiseChatCommands(HMODULE baseAddress)
{
	SayText = (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);
}