Also notify say_team

This commit is contained in:
Federico Cecchetto 2021-06-18 22:26:18 +02:00
parent e84cfe54a6
commit ec9a2ad7fa

View File

@ -4,7 +4,6 @@
#include "game/scripting/entity.hpp" #include "game/scripting/entity.hpp"
#include "game/scripting/execution.hpp" #include "game/scripting/execution.hpp"
#include "notifies.hpp"
namespace notifies namespace notifies
{ {
@ -12,16 +11,13 @@ namespace notifies
{ {
utils::hook::detour client_command_hook; utils::hook::detour client_command_hook;
utils::hook::detour scr_player_killed_hook;
utils::hook::detour scr_player_damage_hook;
void client_command_stub(int clientNum) void client_command_stub(int clientNum)
{ {
char cmd[1024] = { 0 }; char cmd[1024] = { 0 };
game::SV_Cmd_ArgvBuffer(0, cmd, 1024); game::SV_Cmd_ArgvBuffer(0, cmd, 1024);
if (cmd == "say"s) if (cmd == "say"s || cmd == "say_team"s)
{ {
std::string message = game::ConcatArgs(1); std::string message = game::ConcatArgs(1);
message.erase(0, 1); message.erase(0, 1);
@ -29,8 +25,8 @@ namespace notifies
const scripting::entity level{*game::levelEntityId}; const scripting::entity level{*game::levelEntityId};
const auto player = scripting::call("getEntByNum", {clientNum}).as<scripting::entity>(); const auto player = scripting::call("getEntByNum", {clientNum}).as<scripting::entity>();
scripting::notify(level, "say", {player, message}); scripting::notify(level, cmd, {player, message});
scripting::notify(player, "say", {message}); scripting::notify(player, cmd, {message});
} }
return client_command_hook.invoke<void>(clientNum); return client_command_hook.invoke<void>(clientNum);