Types: Difference between revisions

Jump to navigation Jump to search
3,126 bytes added ,  5 September 2023
no edit summary
No edit summary
No edit summary
Line 80: Line 80:
Other types.
Other types.
* <code>void</code> - Represents no arguments or no returns.
* <code>void</code> - Represents no arguments or no returns.
==Handle Existence Span==
{| class="wikitable"
!Type
!Side
!Handle Creation
!Handle Destruction (With 0 handle references left in scripting too)
|-
|Client
|Server-Side
|When a client is attempting to join the server. [[OnPlayerJoin|OnPlayerJoin]].
|When a client has begun leaving the server. [[OnPlayerQuit|OnPlayerQuit]].
|-
|Client (Local)
|Client-Side
|When a client has joined the server, and the local client's client-side has been notified.
|n/a
|-
|Client (Remote)
|Client-Side
|When a client has joined the server, and the remote clients' client-side have been notified.
|When a client has begun leaving the server, and the remote clients' client-side have been notified.
|-
|Player
|Server-Side
|When the client's player-ped has spawned. [[OnPedSpawn|OnPedSpawn]].
|When the client's player-ped has de-spawned. [[OnPedWasted|OnPedWasted]].
|-
|Player (Local)
|Client-Side
|When the client's player-ped has spawned. [[OnPedSpawn|OnPedSpawn]].
|When the client's player-ped has de-spawned. [[OnPedWasted|OnPedWasted]].
|-
|Player (Remote)
|Client-Side
|When any of these qualifying conditions occur:<br>
* The remote client's player-ped has spawned, assuming the local client's player-ped is spawned.<br>
* The remote client's player-ped has streamed back into streaming range of the<br>local client's player-ped 3D position, assuming both the local client's player-ped is spawned and<br>depending on <code>NetFlags</code> values qualify for all applicable elements.<br>
* The local client's player-ped has spawned.<br>
[[OnPedSpawn|OnPedSpawn]] [[OnElementStreamIn|OnElementStreamIn]].
|When any of these qualifying conditions occur:<br>
* The remote client's player-ped has de-spawned, assuming the local client's player-ped is spawned.<br>
* The remote client's player-ped has streamed out of streaming range of the<br>local client's player-ped 3D position, assuming both the local client's player-ped is spawned and<br>depending on <code>NetFlags</code> values qualify for all applicable elements.<br>
* The local client's player-ped has de-spawned.<br>
[[OnPedWasted|OnPedWasted]] [[OnElementStreamOut|OnElementStreamOut]].
|}
Please note, a handle that is not properly de-referenced will cause the handle to not be internally destructed.<br>
As a result, this can give the illusion that some functions are broken when they aren't, such as the result of [[getElementsByType|getElementsByType]] including more than one array entry for the "same element", which are unequal in scripting comparison operators, after internal re-construction, eg. when a client-side player streams out of distance radius of the local player and then streams back in.<br>
To properly de-reference a handle when it's no longer needed, be sure to use <code>delete myVariable;</code> or <code>myVariable = null;</code> in JS, or <code>myVariable = nil</code> in Lua, where applicable.<br>
Continuous attempts of internal destruction of a handle occurs when the qualifying internal destruction reason has occurred, until there are no references remaining in scripting for the handle, rather than only one internal destruction attempt.


==Previous Versions==
==Previous Versions==
6,833

edits

Navigation menu