Skip to content

Commit 187df2d

Browse files
committed
refactor: better feedback for MP::Set fail
1 parent b77aaaa commit 187df2d

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

src/LuaAPI.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,27 @@ static bool mDisableMPSet = [] {
312312
return DisableMPSet == "true" || DisableMPSet == "1";
313313
}();
314314

315+
static auto GetSettingName = [](int id) -> const char* {
316+
switch (id) {
317+
case 0: return "Debug";
318+
case 1: return "Private";
319+
case 2: return "MaxCars";
320+
case 3: return "MaxPlayers";
321+
case 4: return "Map";
322+
case 5: return "Name";
323+
case 6: return "Description";
324+
case 7: return "InformationPacket";
325+
default: return "Unknown";
326+
}
327+
};
328+
315329
void LuaAPI::MP::Set(int ConfigID, sol::object NewValue) {
316330
if (mDisableMPSet) {
317-
beammp_info("This feature has been disabled by your server provider.");
331+
beammp_lua_error(
332+
std::string("A script tried to call MP.Set to change setting '")
333+
+ GetSettingName(ConfigID)
334+
+ "' but this was blocked by your server provider."
335+
);
318336
return;
319337
}
320338

0 commit comments

Comments
 (0)