NetworkEvents: Difference between revisions

From GTA Connected
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:


== What are Network Events? ==
== What are Network Events? ==
Custom scripted events between server and client. They allow a server to tell a client something and vice verse. Useful for providing extra sync, telling the other side to call a function, or simply sending data between the server and clients.
Custom scripted events between server and client. They allow a server to tell a client something and vice verse. Useful for providing extra sync, telling the other side to call a function, or simply sending data back and forth.


== How do I use them? ==
== How do I use them? ==

Revision as of 08:25, 1 September 2025


What are Network Events?

Custom scripted events between server and client. They allow a server to tell a client something and vice verse. Useful for providing extra sync, telling the other side to call a function, or simply sending data back and forth.

How do I use them?

Network events are universal, regardless of which side is sending and receiving (server or client). On the "sender" side, use triggerNetworkEvent, and on the receiver side use a network event handler to run code when receiving it. The only difference is when receiving a network event on the server, a client object will be the first arg in the handler function.

What are some examples?