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
Add set/getPlayerScriptDebugLevel #826
Add set/getPlayerScriptDebugLevel #826
Conversation
Thanks for your PR. I have a question: Why not Also we dropped the hungarian notation for new devs (even though I prefer when the code is consistant). Would be great if we could give mtasa-blue/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp Lines 3051 to 3058 in 9c8ca2e
|
@Citizen01 I modified the functions to work with the root element, i didn't changed the hungarian notation as i don't know what to replace them with. About the naming: I used setPlayerDebugView* instead of setPlayerDebugger* because of the existing (clientside) function named setDebugViewActive but i'm open to change it if others think its better 😃. Thanks for the review. |
You can also enable debugscript for "Everyone" in the ACL to get around this |
@qaisjp Then everyone would have access to /debugscript, which is something i don't want, Or am i missing something? @CrosRoad95 I fixed some things you mentioned, i also tried to fix the others whitespace changes but git didn't picked them (i don't know why) but i don't think they are relevant as they don't change anything visually. |
Oh, now I understand your problem. How about There should be a getter. |
@qaisjp Wouldn't it be better to pass 0 to setPlayerScriptDebugLevel to hide the debugger? In a similar way the getter (getPlayerScriptDebugLevel?) would return 0 if the player had the debugger closed. This is the current behaviour of /debugscript. |
I thought about that but don't want to conflict with |
Also remove setPlayerDebugView* functions
@qaisjp Ok, i added set/getPlayerScriptDebugLevel, passing false to setPlayerScriptDebugLevel hides the debugger and passing an integer shows it. |
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 believe it is better to match these function names as well.
…StaticFunctionDefinitions)
@patrikjuvonen Done :) |
Thanks for the changes. This PR is ready to be merged but I'd wait for #821 so we can make returns right for this from the start. |
The decision in pull request #821 (Pin down return value on failure) is now settled. |
Done @patrikjuvonen :) |
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.
Thank you!
Good job. This PR is ready to be merged afrer 1.5.7 is released.
Sorry about late review, but does |
@ccw808 Well, my thought for doing this was that a malicious resource could make a backdoor command which would allow the attacker to read all the debug messages, gaining knowledge on the internals of the server or observing how a specific system reacts to certain inputs etc depending on how the server uses the logging functions. With that scenario in mind i put it in the admin ACL, also to conform with /debugscript. |
No, you're right, 0 is better for closing |
While i was making a new account system (MySQL) i found out i couldn't use /debugscript without creating an account in MTA's database AND adding it to the ACL, that was a problem because when i logged in my system i also had to login in MTA's system using /login to be able to view script errors, that's why i created this pull request, with this i could add a /debug command which would simulate /debugscript.
This PR adds two new functions, setPlayerScriptDebugLevel and getPlayerScriptDebugLevel, I'm fairly new to the MTA's codebase so i don't know if i made any mistake.