Skip to content

Commit 02fd30d

Browse files
committed
feature: BEAMMP_PROVIDER_DISABLE_MP_SET environment variable
fix: using wrong feedback method
1 parent 9fa9974 commit 02fd30d

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

include/Env.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ enum class Key {
2626
// provider settings
2727
PROVIDER_UPDATE_MESSAGE,
2828
PROVIDER_DISABLE_CONFIG,
29+
PROVIDER_DISABLE_MP_SET,
2930
PROVIDER_PORT_ENV,
3031
PROVIDER_IP_ENV
3132
};

src/Env.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ std::string_view Env::ToString(Env::Key key) {
3636
case Key::PROVIDER_DISABLE_CONFIG:
3737
return "BEAMMP_PROVIDER_DISABLE_CONFIG";
3838
break;
39+
case Key::PROVIDER_DISABLE_MP_SET:
40+
return "BEAMMP_PROVIDER_DISABLE_MP_SET";
41+
break;
3942
case Key::PROVIDER_PORT_ENV:
4043
return "BEAMMP_PROVIDER_PORT_ENV";
4144
break;

src/LuaAPI.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "CustomAssert.h"
2323
#include "Settings.h"
2424
#include "TLuaEngine.h"
25+
#include "Env.h"
2526

2627
#include <nlohmann/json.hpp>
2728

@@ -307,6 +308,13 @@ std::pair<bool, std::string> LuaAPI::MP::RemoveVehicle(int PID, int VID) {
307308
}
308309

309310
void LuaAPI::MP::Set(int ConfigID, sol::object NewValue) {
311+
auto DisableMPSet = Env::Get(Env::Key::PROVIDER_DISABLE_MP_SET).value_or("false");
312+
bool mDisableMPSet = DisableMPSet == "true" || DisableMPSet == "1";
313+
if (mDisableMPSet) {
314+
beammp_info("This feature has been disabled by your server provider.");
315+
return;
316+
}
317+
310318
switch (ConfigID) {
311319
case 0: // debug
312320
if (NewValue.is<bool>()) {

0 commit comments

Comments
 (0)