OnResourceStop: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | |||
{{Server event}} | |||
This event is triggered when the resource is stopped. This can occur for a number of reasons: | This event is triggered when the resource is stopped. This can occur for a number of reasons: | ||
* The ''stop'' console command was used | * The ''stop'' console command was used | ||
Line 6: | Line 8: | ||
'''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]]. | '''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]]. | ||
==Parameters== | |||
<syntaxhighlight lang="lua"> | |||
element theResourceStopped | |||
</syntaxhighlight> | |||
*'''theResourceStopped''': The resource that is being stopped. | |||
<!-- Add the event's source in the section below --> | |||
==Source== | |||
The [[event system#Event source|source]] of this event is the root [[element]] of the resource that is being stopped. | |||
==Example== | ==Example== | ||
Line 11: | Line 24: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addEventHandler ( "onResourceStop", root, | addEventHandler ( "onResourceStop", root, | ||
function ( resource ) | function ( resource ) | ||
Line 17: | Line 29: | ||
end | end | ||
) | ) | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 05:52, 30 December 2007
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.
Parameters
element theResourceStopped
- theResourceStopped: The resource that is being stopped.
Source
The source of this event is the root element of the resource that is being stopped.
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 )