Add MP.SendNotification

This commit is contained in:
Tixx
2024-09-28 13:35:25 +02:00
parent 7f69e336a9
commit 3ade7f5743
3 changed files with 41 additions and 0 deletions

View File

@@ -869,6 +869,15 @@ TLuaEngine::StateThreadData::StateThreadData(const std::string& Name, TLuaStateI
return Lua_GetPositionRaw(PID, VID);
});
MPTable.set_function("SendChatMessage", &LuaAPI::MP::SendChatMessage);
MPTable.set_function("SendNotification", [&](sol::variadic_args Args) {
if (Args.size() == 3) {
LuaAPI::MP::SendNotification(Args.get<int>(0), Args.get<std::string>(1), Args.get<std::string>(2), Args.get<std::string>(1));
} else if (Args.size() == 4) {
LuaAPI::MP::SendNotification(Args.get<int>(0), Args.get<std::string>(1), Args.get<std::string>(2), Args.get<std::string>(3));
} else {
beammp_lua_error("SendNotification expects 2 or 3 arguments.");
}
});
MPTable.set_function("GetPlayers", [&]() -> sol::table {
return Lua_GetPlayers();
});