OnResourceLoadStateChange

From Multi Theft Auto: Wiki
Revision as of 19:17, 21 January 2021 by Srslyyyy (talk | contribs) (Add onResourceLoadStateChange event by TeteX1.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

Click to collapse [-]
Example 1

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)

See Also

Resource events


Event functions