NetworkEvents: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
 
Line 5: Line 5:


== 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.<br />
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.
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)]]
2,813

edits

Navigation menu