OnResourceLoadStateChange: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Server event}}
{{Server event}}
{{Added feature/item|3.0159|1.5.9|1.5.8|20809|This event is triggered when a [[resource]] load state is changed.}}
{{Added feature/item|1.5.9|1.5.8|20809|This event is triggered when a [[resource]] load state is changed.}}
__NOTOC__
__NOTOC__
==Parameters==
==Parameters==

Revision as of 21:24, 23 September 2021

This event is triggered when a resource load state is changed.

Parameters

resource changedResource, string oldState, string newState
  • changedResource: The resource that was either loaded, reloaded or is unloading.
  • oldState: The state the resource was in before it changed.
  • newState: The state the resource has changed to.

Source

The source of this event is the root element.

Example

This code will output the state of resource when it's state will be changed:

function onResourceLoadStateChange (resource, oldState, newState)
    print ("Resource "..getResourceName (resource).." has changed it's state from "..tostring (oldState).." to "..tostring (newState))
end

addEventHandler ("onResourceLoadStateChange", root, onResourceLoadStateChange)

Requirements

This template will be deleted.

See Also

Resource events


Event functions