OnClientResourceStart: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
(Fixed a minor typo.) |
||
(7 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{Client event}} | {{Client event}} | ||
__NOTOC__ | __NOTOC__ | ||
This event is triggered when a [[resource]] is started. | This event is triggered when a [[resource]] is started. Please note that this is '''not''' triggered the same time as the serverside event [[onResourceStart]] is. The event is triggered when any ''clientside resources'' are started. This means it is triggered when a clientside script is initiated after a download, which includes downloading after join. So: | ||
* If a resource is running '''before''' a player joins, the onClientResourceStart event will be triggered after they join and have downloaded that resource. | |||
* If a resource is started '''after''' a player has joined, the player will be made to download the required files, and then the onClientResourceStart event will be triggered. | |||
==Parameters== | ==Parameters== | ||
Line 11: | Line 14: | ||
==Source== | ==Source== | ||
The [[event system#Event source|source]] of this event is the | The [[event system#Event source|source]] of this event is the started resource's [[root element]]. | ||
==Example== | ==Example== | ||
This example outputs name of resource that was started. | |||
<syntaxhighlight lang="lua"> | |||
addEventHandler( "onClientResourceStart", getRootElement( ), | |||
function ( startedRes ) | |||
outputChatBox( "Resource started: " .. getResourceName( startedRes ) ); | |||
end | |||
); | |||
</syntaxhighlight> | |||
==See Also== | |||
===Client resource events=== | |||
{{Client_resource_events}} | |||
===Client event functions=== | |||
{{Client_event_functions}} |
Latest revision as of 20:22, 19 February 2010
This event is triggered when a resource is started. Please note that this is not triggered the same time as the serverside event onResourceStart is. The event is triggered when any clientside resources are started. This means it is triggered when a clientside script is initiated after a download, which includes downloading after join. So:
- If a resource is running before a player joins, the onClientResourceStart event will be triggered after they join and have downloaded that resource.
- If a resource is started after a player has joined, the player will be made to download the required files, and then the onClientResourceStart event will be triggered.
Parameters
resource startedResource
- startedResource: the resource that was started.
Source
The source of this event is the started resource's root element.
Example
This example outputs name of resource that was started.
addEventHandler( "onClientResourceStart", getRootElement( ), function ( startedRes ) outputChatBox( "Resource started: " .. getResourceName( startedRes ) ); end );
See Also
Client resource events
Client event functions
- triggerLatentServerEvent
- triggerServerEvent
- Shared
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled