onResourceStateChange | Multi Theft Auto: Wiki Skip to content

onResourceStateChange

Client-side
Server-side
Shared

This event is triggered when a resource's state is changed. This event is an extended version of onResourceLoadStateChange

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

element: The source of this event is the root element.

Code Examples

server

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

addEventHandler('onResourceStateChange', root, function(res, oldState, newState)
iprint('Resource '..getResourceName(res)..' has changed its state from '..oldState..' to '..newState)
end)