-
-
Notifications
You must be signed in to change notification settings - Fork 78
feature: BEAMMP_PROVIDER_DISABLE_MP_SET environment variable #461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: minor
Are you sure you want to change the base?
Conversation
fix: using wrong feedback method
src/LuaAPI.cpp
Outdated
|
|
||
| void LuaAPI::MP::Set(int ConfigID, sol::object NewValue) { | ||
| if (mDisableMPSet) { | ||
| beammp_lua_error( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the lua state name/plugin name be included instead of "A script"?
and could you use the format version of the log functions to make the code cleaner?
Example:
Line 157 in 9fa9974
| beammp_lua_errorf("Respond failed, dropping client {}", PlayerID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the lua state name/plugin name be included instead of "A script"?
I could not figure out how to do this, and there is no other method which does this as far as I can tell (to copy from)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose you could move the check (and error message) to
BeamMP-Server/src/TLuaEngine.cpp
Line 921 in 6f196ac
| MPTable.set_function("Set", &LuaAPI::MP::Set); |
Something like:
if (mDisableMPSet) {
MP.set_function("Set", [this](int ConfigID, sol::object NewValue){
beammp_lua_errorf("A script ({}) tried to call MP.Set to change setting '{}' but this was blocked by your server provider.", StateId, GetSettingName(ConfigID));
});
} else {
MPTable.set_function("Set", &LuaAPI::MP::Set);
}
This pull request adds BEAMMP_PROVIDER_DISABLE_MP_SET variable (true/false/1/0) to disable MP::Set for providers.
By creating this pull request, I understand that code that is AI generated or otherwise automatically generated may be rejected without further discussion.
I declare that I fully understand all code I pushed into this PR, and wrote all this code myself and own the rights to this code.