Interface administrators, moderator
2,818
edits
(Created page with "{{DISPLAYTITLE: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, calling functions, or simply sending data between the server and clients. == 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|triggerNetworkEve...") |
No edit summary |
||
| (6 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{DISPLAYTITLE:Network Events}} | {{DISPLAYTITLE:Network Events}} | ||
== What are Network Events? == | == What are Network Events? == | ||
Custom scripted events between server and client. They allow | Custom scripted events between server and client. They allow either side (server or client) to "tell" the other side something.<br /> | ||
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? == | ||
Network events are universal, regardless of which side is sending and receiving (server or client). On the "sender" side, use [[triggerNetworkEvent|triggerNetworkEvent]], and on the receiver side use a [[addNetworkHandler|network event handler]] to run code when receiving it. | Network events are universal, regardless of which side is sending and receiving (server or client). On the "sender" side, use [[triggerNetworkEvent|triggerNetworkEvent]], and on the "receiver" side use a [[addNetworkHandler|network event handler]] to run code when receiving it.<br /> | ||
The only difference is when receiving a network event on the server, a ''client'' object will be the first arg in the handler function so the script knows which client sent it. | |||
== What are some examples? == | == What are some examples? == | ||
* [[ScriptingExamples/PlayerSetPositionNativeMP|Set Own Player's Position (GTA IV, Native MP Mode)]] | * [[ScriptingExamples/PlayerSetPositionNativeMP|Set Own Player's Position (GTA IV, Native MP Mode)]] | ||