OnResourceStart: Difference between revisions

m (Typo: resouce -> resource)
 
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{ScriptItem
{{ScriptItem2
|endpoint = shared
|name = onResourceStart
|side = shared
|type = event
|type = event
|name = onResourceStart
|games = iii vc sa iv
|usage = a resource starts
|desc = a resource has started. The event is triggered after all script files have been ran in the resource's meta.xml file.
|callbackParameters = Event event, Resource resource
|arg1 = Resource resource The resource which has started.
|cancellable = true
|notes = This event can be used with [[bindEventHandler|bindEventHandler]].<br>
|parameter1 = Resource resource The resource which has started.
The [[OnResourceReady|OnResourceReady]] is also called at the same as this event IF the resource is ready (ready = all files downloaded).
|notes = This event can be used with [[bindEventHandler|bindEventHandler]].
|cancel = true
|exampleLua = addEventHandler("OnResourceStart", function(event,resource)
|exampleLua = addEventHandler("OnResourceStart", function(event,resource)
outputChatBox("Resource ".. resource.name .." has started.", COLOUR_RED)
outputChatBox("Resource ".. resource.name .." has started.", COLOUR_RED)
end)
end)
}}
}}

Latest revision as of 16:43, 9 November 2025

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

Available since Server 1.0.0, Client 1.0.0
onResourceStart(Event event, Resource resource)
The onResourceStart event is invoked when a resource has started. The event is triggered after all script files have been ran in the resource's meta.xml file.

Parameters

1) Event event The event object for this event.
2) Resource resource The resource which has started.

Attributes

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

Notes

  • This event can be used with bindEventHandler.
  • The OnResourceReady is also called at the same as this event IF the resource is ready (ready = all files downloaded).

Examples

Example 1 - Lua:

addEventHandler("OnResourceStart", function(event,resource)
	outputChatBox("Resource ".. resource.name .." has started.", COLOUR_RED)
end)

Compatibility

There isn't any compatibility information for this event.

Related

Server Related

        OnResourceStart
        OnResourceStop


Client Related

        OnResourceReady
        OnResourceStart
        OnResourceStop