From fb2e26bd283de115dc06c8033324556509147a65 Mon Sep 17 00:00:00 2001 From: Tixx <83774803+WiserTixx@users.noreply.github.com> Date: Tue, 12 Nov 2024 12:35:12 +0100 Subject: [PATCH] Allow for empty icon param in MP.SendNotification --- src/LuaAPI.cpp | 2 +- src/TLuaEngine.cpp | 6 ++++-- src/TServer.cpp | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/LuaAPI.cpp b/src/LuaAPI.cpp index 4da07b3..fe16fe7 100644 --- a/src/LuaAPI.cpp +++ b/src/LuaAPI.cpp @@ -207,7 +207,7 @@ std::pair LuaAPI::MP::SendChatMessage(int ID, const std::stri std::pair LuaAPI::MP::SendNotification(int ID, const std::string& Message, const std::string& Icon, const std::string& Category) { std::pair Result; - std::string Packet = "N" + Category + ":" + Icon + ":" + Message; + std::string Packet = "n" + Category + ":" + Icon + ":" + Message; if (ID == -1) { Engine->Network().SendToAll(nullptr, StringToVector(Packet), true, true); Result.first = true; diff --git a/src/TLuaEngine.cpp b/src/TLuaEngine.cpp index fb3f4c6..fbd5758 100644 --- a/src/TLuaEngine.cpp +++ b/src/TLuaEngine.cpp @@ -880,12 +880,14 @@ TLuaEngine::StateThreadData::StateThreadData(const std::string& Name, TLuaStateI }); MPTable.set_function("SendChatMessage", &LuaAPI::MP::SendChatMessage); MPTable.set_function("SendNotification", [&](sol::variadic_args Args) { - if (Args.size() == 3) { + if (Args.size() == 2) { + LuaAPI::MP::SendNotification(Args.get(0), Args.get(1), "", Args.get(1)); + } else if (Args.size() == 3) { LuaAPI::MP::SendNotification(Args.get(0), Args.get(1), Args.get(2), Args.get(1)); } else if (Args.size() == 4) { LuaAPI::MP::SendNotification(Args.get(0), Args.get(1), Args.get(2), Args.get(3)); } else { - beammp_lua_error("SendNotification expects 2 or 3 arguments."); + beammp_lua_error("SendNotification expects 2, 3 or 4 arguments."); } }); MPTable.set_function("GetPlayers", [&]() -> sol::table { diff --git a/src/TServer.cpp b/src/TServer.cpp index c6b94bb..6020662 100644 --- a/src/TServer.cpp +++ b/src/TServer.cpp @@ -253,7 +253,6 @@ void TServer::GlobalParser(const std::weak_ptr& Client, std::vector