- Documentation
- Server events
- onPlayerChangesProtectedData
Event
onPlayerChangesProtectedData
A client script tried to change a protected element data key: a key set by the server with setElementData(..., "deny"), or any key when server-config.json has "element_data_client_changes": "deny". The change is rejected and the player gets the server value back.
Handler
addEventHandler("onPlayerChangesProtectedData", root, function(element, key, value) ... end)Parameters
elementelement- The element whose data was changed.Not in MTA:SA
keystring- The key.Not in MTA:SA
valuemixed- The value the client sent (
nilfor a removal attempt).Not in MTA:SA
Differences from MTA:SA
- Parameters in a different colour differ from MTA:SA.
In MTA:SA
function()Source
source is the player who sent the change.
Example
addEventHandler("onPlayerJoin", root, function()
setElementData(source, "money", 0, true, "deny")
end)
addEventHandler("onPlayerChangesProtectedData", root, function(element, key, value)
outputServerLog(getPlayerName(source) .. " probowal zmienic " .. key)
end)