add say/tell + update submodules
This commit is contained in:
2
deps/GSL
vendored
2
deps/GSL
vendored
Submodule deps/GSL updated: 991fa6682e...c52bad36aa
2
deps/asmjit
vendored
2
deps/asmjit
vendored
Submodule deps/asmjit updated: 15a6036618...8f2c237b83
2
deps/curl
vendored
2
deps/curl
vendored
Submodule deps/curl updated: 3ccaddc9fc...a0d8a1aa91
2
deps/lua
vendored
2
deps/lua
vendored
Submodule deps/lua updated: 26be27459b...c954db3924
@ -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{};
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user