add say/tell + update submodules

This commit is contained in:
m 2022-10-22 23:21:05 -05:00
parent 8aa10c7dc5
commit 4893a44954
5 changed files with 32 additions and 4 deletions

2
deps/GSL vendored

@ -1 +1 @@
Subproject commit 991fa6682e819590c695f00c6b880548e55fa914
Subproject commit c52bad36aa9d5ececcdf6be2d5cd2dce9daa4194

2
deps/asmjit vendored

@ -1 +1 @@
Subproject commit 15a603661871b86c048e697f0e6cd17374dcecc0
Subproject commit 8f2c237b8315a7d662e0e67d06807296a7bbe5ab

2
deps/curl vendored

@ -1 +1 @@
Subproject commit 3ccaddc9fcaed6dfbce0f1cf14e5933141cddac6
Subproject commit a0d8a1aa91073a87b3b996050aff66603f03873d

2
deps/lua vendored

@ -1 +1 @@
Subproject commit 26be27459b11feabed52cf40aaa76f86c7edc977
Subproject commit c954db39241a8b21d7b32b42b87a066b4708f969

View File

@ -464,6 +464,34 @@ namespace gsc
// return 0 so the game doesn't override the cfg
return 0;
});
function::add("say", [](const function_args& args)
{
const auto message = args[0].as<std::string>();
game::SV_GameSendServerCommand(-1, game::SV_CMD_CAN_IGNORE, utils::string::va("%c \"%s\"", 84, message.data()));
return scripting::script_value{};
});
method::add("tell", [](const game::scr_entref_t ent, const function_args& args)
{
if (ent.classnum != 0)
{
throw std::runtime_error("Invalid entity");
}
const auto client = ent.entnum;
if (game::mp::g_entities[client].client == nullptr)
{
throw std::runtime_error("Not a player entity");
}
const auto message = args[0].as<std::string>();
game::SV_GameSendServerCommand(client, game::SV_CMD_CAN_IGNORE, utils::string::va("%c \"%s\"", 84, message.data()));
return scripting::script_value{};
});
}
};
}