From 8e493af76ab5f211a020928f82e3e132c2414e2b Mon Sep 17 00:00:00 2001 From: John Lillis Date: Sun, 7 Sep 2025 13:29:46 -0400 Subject: [PATCH 1/4] hedit: reduce console spam Removed extra `print` calls, replaced others with `outputDebugScript` where appropriate. --- [gameplay]/hedit/server/cfgloader.lua | 24 ++++++++++++------------ [gameplay]/hedit/server/core.lua | 15 ++------------- 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/[gameplay]/hedit/server/cfgloader.lua b/[gameplay]/hedit/server/cfgloader.lua index 09cbefd17..d47e3b882 100644 --- a/[gameplay]/hedit/server/cfgloader.lua +++ b/[gameplay]/hedit/server/cfgloader.lua @@ -26,7 +26,7 @@ function loadCFGIntoMemory ( cfgstr ) waitForLine = false if addingEntry then - print ( "[HEDIT] Error while adding line #"..tostring(#lines)..", invalid character found: "..token ) + outputDebugString ( "[HEDIT] Error while adding line #"..tostring(#lines)..", invalid character found: "..token, 1) table.remove ( lines, #lines ) addingEntry = false end @@ -63,9 +63,9 @@ function loadCFGIntoMemory ( cfgstr ) if #lines > 0 then - print ( "[HEDIT] Loaded "..tostring(#lines).." handling entries from "..tostring(string.len(cfgstr)).." bytes into the memory." ) - print ( "[HEDIT] Type 'exportcfg' to import the handling entries into defaults.xml." ) - print ( "[HEDIT] This may take some time." ) + outputDebugString ( "[HEDIT] Loaded "..tostring(#lines).." handling entries from "..tostring(string.len(cfgstr)).." bytes into the memory." ) + outputDebugString ( "[HEDIT] Type 'exportcfg' to import the handling entries into defaults.xml." ) + outputDebugString ( "[HEDIT] This may take some time." ) addCommandHandler ( "exportcfg", function ( player ) @@ -73,8 +73,8 @@ function loadCFGIntoMemory ( cfgstr ) return false end - print ( "[HEDIT] Importing "..line.." handling entries into defaults.xml." ) - print ( "[HEDIT] This may take a while. Please wait." ) + outputDebugString ( "[HEDIT] Importing "..line.." handling entries into defaults.xml." ) + outputDebugString ( "[HEDIT] This may take a while. Please wait." ) setTimer ( function ( ) exportToDefaults ( lines ) @@ -85,8 +85,8 @@ function loadCFGIntoMemory ( cfgstr ) return true end - print ( "[HEDIT] No handling entries found in "..tostring(string.len(cfgstr)).." bytes!") - print ( "[HEDIT] Make sure handling.cfg is correct and try again." ) + outputDebugString ( "[HEDIT] No handling entries found in "..tostring(string.len(cfgstr)).." bytes!", 2) + outputDebugString ( "[HEDIT] Make sure handling.cfg is correct and try again.", 2 ) return true end @@ -113,7 +113,7 @@ function exportToDefaults ( linetabs ) if id == 1 then if not tonumber ( value ) then - print ( "[HEDIT] Handling line #"..tostring(num).." is invalid, can't import!" ) + outputDebugString ( "[HEDIT] Handling line #"..tostring(num).." is invalid, can't import!", 1 ) break end @@ -156,8 +156,8 @@ addCommandHandler ( "loadcfg", function ( player ) fileClose ( cfgFile ) - print ( "[HEDIT] handling.cfg has been read." ) - print ( "[HEDIT] Please wait while loading the lines into the memory." ) + outputDebugString ( "[HEDIT] handling.cfg has been read." ) + outputDebugString ( "[HEDIT] Please wait while loading the lines into the memory." ) setTimer ( function ( ) loadCFGIntoMemory ( str ) @@ -166,6 +166,6 @@ addCommandHandler ( "loadcfg", function ( player ) return true end - print ( "[HEDIT] No handling.cfg found. Make sure it's in the root of this resource." ) + outputDebugString ( "[HEDIT] No handling.cfg found. Make sure it's in the root of this resource.", 2 ) return false end ) diff --git a/[gameplay]/hedit/server/core.lua b/[gameplay]/hedit/server/core.lua index 06d3928d1..f28cca442 100644 --- a/[gameplay]/hedit/server/core.lua +++ b/[gameplay]/hedit/server/core.lua @@ -10,23 +10,12 @@ addEventHandler ( "onResourceStart", resourceRoot, function ( ) setElementData(resourceRoot, "resourceVersion", getResourceInfo(resource, "version")) if resName ~= "hedit" and not DEBUGMODE then - outputChatBox ( "Handling Editor failed to start, see the logs for more information." ) - print ( "===============================================================================" ) - print ( "[HEDIT] Please rename resource '"..resName.."' to 'hedit' to use the handling editor." ) - print ( "[HEDIT] The handling editor will not work unless you rename the resource to 'hedit'." ) - print ( "===============================================================================" ) + print ( "[HEDIT] Please rename resource '"..resName.."' to 'hedit' to use the handling editor.") return cancelEvent ( true, "Rename the handling editor resource to 'hedit' in order to use the resource." ) end - - print ( "===============================================================================" ) - print ( " MTA:SA HANDLING EDITOR [hedit.github.io]" ) - print ( "===============================================================================" ) if fileExists ( "handling.cfg" ) then - print ( " Handling.cfg found." ) - print ( " Type 'loadcfg' to load handling.cfg into the memory." ) - print ( " After this, you can import the handling into defaults.xml." ) - print ( "===============================================================================" ) + print ( "[HEDIT] Handling.cfg found; type 'loadcfg' to load handling.cfg into the memory.") end --Parse meta settings From 80dbeb142bf50374c490700a105d1e67f53a7f22 Mon Sep 17 00:00:00 2001 From: John Lillis Date: Sun, 7 Sep 2025 14:07:09 -0400 Subject: [PATCH 2/4] hedit: improve element data security Improves the security of resource data by using the new `clientChangesPolicy` parameter where appropriate. --- [gameplay]/hedit/meta.xml | 4 ++-- [gameplay]/hedit/server/core.lua | 4 +--- [gameplay]/hedit/server/logmanager.lua | 6 +++--- [gameplay]/hedit/server/utils.lua | 2 +- [gameplay]/hedit/shared/utils.lua | 10 +++++----- [gameplay]/hedit/shared/wrappers/handling.lua | 4 ++-- 6 files changed, 14 insertions(+), 16 deletions(-) diff --git a/[gameplay]/hedit/meta.xml b/[gameplay]/hedit/meta.xml index b0ed6710d..22e78832f 100644 --- a/[gameplay]/hedit/meta.xml +++ b/[gameplay]/hedit/meta.xml @@ -1,7 +1,7 @@ - + true - +