triggerNetworkEvent: Difference between revisions

From GTA Connected
Jump to navigation Jump to search
No edit summary
(No difference)

Revision as of 18:05, 7 May 2020

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

Available since Server 1.0.0, Client 1.0.0
Server:

void triggerNetworkEvent(string networkEventName, null or Client client, [ ... ])

Client:

void triggerNetworkEvent(string networkEventName, [ ... ])

The triggerNetworkEvent function is used to trigger a custom network event.

Parameters

1) string networkEventName The name of the network event, case-insensitive.
2) Client client Can be null. The client to trigger the network event for.
3) vararg ... Optional, defaults to n/a. Arguments to send to the scripting functions that are bound to the network event.

Return

void This function doesn't return a value.

Notes

  • When used in a server script, use null to send the event to all clients or specify a client object. See addNetworkHandler for information regarding custom event handler functions.
  • .

Examples

Example 1 - JavaScript - Server-Side:

function makeCivilianWalkToPos(civilian, x, y, z) {

   triggerNetworkEvent("walkToPos", null, civilian, x, y);

}

Compatibility

There isn't any compatibility information for this function.

Related

Server Related

icon-iii.png icon-vc.png icon-sa.png icon-iv.png addNetworkHandler
icon-iii.png icon-vc.png icon-sa.png icon-iv.png removeNetworkHandler


Client Related

icon-iii.png icon-vc.png icon-sa.png icon-iv.png addNetworkHandler
icon-iii.png icon-vc.png icon-sa.png icon-iv.png connect
icon-iii.png icon-vc.png icon-sa.png icon-iv.png disconnect
icon-iv.png gta.shutdownAndLaunchNetworkGame
icon-iii.png icon-vc.png icon-sa.png icon-iv.png isConnected
icon-iii.png icon-vc.png icon-sa.png icon-iv.png isConnecting
icon-iii.png icon-vc.png icon-sa.png icon-iv.png removeNetworkHandler