mirror of
https://github.com/fedddddd/iw5-gsc-utils.git
synced 2025-07-03 17:51:55 +00:00
Add tell, say functions
This commit is contained in:
@ -330,6 +330,29 @@ namespace gsc
|
||||
return {};
|
||||
});
|
||||
|
||||
function::add("say", [](function_args args) -> scripting::script_value
|
||||
{
|
||||
const auto message = args[0].as<std::string>();
|
||||
game::SV_GameSendServerCommand(-1, 0, utils::string::va("%c \"%s\"", 84, message.data()));
|
||||
|
||||
return {};
|
||||
});
|
||||
|
||||
method::add("tell", [](game::scr_entref_t ent, function_args args) -> scripting::script_value
|
||||
{
|
||||
if (ent.classnum != 0)
|
||||
{
|
||||
throw std::runtime_error("Invalid type");
|
||||
}
|
||||
|
||||
const auto client = ent.entnum;
|
||||
const auto message = args[0].as<std::string>();
|
||||
|
||||
game::SV_GameSendServerCommand(client, 0, utils::string::va("%c \"%s\"", 84, message.data()));
|
||||
|
||||
return {};
|
||||
});
|
||||
|
||||
utils::hook::jump(0x56C8EB, call_builtin_stub);
|
||||
utils::hook::jump(0x56CBDC, call_builtin_method_stub);
|
||||
utils::hook::jump(0x56B726, vm_execute_stub);
|
||||
|
Reference in New Issue
Block a user