OnResourceStop

From Multi Theft Auto: Wiki
Revision as of 04:08, 5 July 2007 by EAi (talk | contribs)
Jump to navigation Jump to search

This event is triggered when the resource is stopped. This can occur for a number of reasons:

  • The stop console command was used
  • The restart console command was used
  • The resource was modified (the resource will automatically restart)
  • Another resource stopped it using stopResource.

Note: If you wish to just detect a single resource being stopped, you should attach handlers for this event to the resource's root element. You can access this using getResourceRootElement.

Example

This example displays a message in the chatbox when a resource is stopped.


addEventHandler ( "onResourceStop", root, 
    function ( resource )
        outputChatBox ( "The Resource " .. getResourceName(resource) .. " was stopped!", root, 255, 255, 255 )
    end 
)