OnResourceStop: Difference between revisions

From GTA Connected
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
{{ScriptItem
{{ScriptItem2
|endpoint = shared
|name = onResourceStop
|side = shared
|type = event
|type = event
|name = onResourceStop
|games = iii vc sa iv
|usage = a resource stops
|desc = a resource stops
|callbackParameters = Event event, Resource resource, bool stoppingForRestart
|arg1 = Resource resource The resource which has stopped.
|cancellable = true
|arg2 = bool stoppingForRestart The status of whether the resource is restarting.
|parameter1 = Resource resource The resource which has stopped.
|cancel = true
|parameter2 = bool stoppingForRestart The status of whether the resource is restarting.
|exampleLua = addEventHandler("OnResourceStop", function(event,resource,stoppingForRestart)
|exampleLua = addEventHandler("OnResourceStop", function(event,resource,stoppingForRestart)
outputChatBox("Resource ".. resouce.name .." has stopped."..(stoppingForRestart and " (restarting)" or ""), COLOUR_RED)
outputChatBox("Resource ".. resouce.name .." has stopped."..(stoppingForRestart and " (restarting)" or ""), COLOUR_RED)
end)
end)
}}
}}

Revision as of 20:28, 19 November 2022

Event Server and Client icon-iii.png icon-vc.png icon-sa.png icon-iv.png Online and Offline Cancellable

Available since Server 1.0.0, Client 1.0.0

onResourceStop(Event event, Resource resource, bool stoppingForRestart)

The onResourceStop event is invoked when a resource stops.

Parameters

1) Event event The event object for this event.
2) Resource resource The resource which has stopped.
3) bool stoppingForRestart The status of whether the resource is restarting.

Attributes

cancellable This event can be cancelled, by using event.preventDefault.

Notes

There aren't any notes for this event.

Examples

Example 1 - Lua:

addEventHandler("OnResourceStop", function(event,resource,stoppingForRestart)
    outputChatBox("Resource ".. resouce.name .." has stopped."..(stoppingForRestart and " (restarting)" or ""), COLOUR_RED)
end)

Compatibility

There isn't any compatibility information for this event.

Related

Server Related

icon-iii.png icon-vc.png icon-sa.png icon-iv.png OnResourceStart
icon-iii.png icon-vc.png icon-sa.png icon-iv.png OnResourceStop


Client Related

icon-iii.png icon-vc.png icon-sa.png icon-iv.png OnResourceReady
icon-iii.png icon-vc.png icon-sa.png icon-iv.png OnResourceStart
icon-iii.png icon-vc.png icon-sa.png icon-iv.png OnResourceStop