SendNetworkString: Difference between revisions

no edit summary
(3.1 is released, so Devfeature templates have been removed)
No edit summary
Tag: Source edit
Line 7: Line 7:
Sends an ACS string from the server to the client(s), or from a client to the server, then executes a script on the receiver's end. If run offline, the script will be executed on the local machine like normal. Note that just like with RequestScriptPuke and NamedRequestScriptPuke, there is no guarantee that the server will receive the string from the client. If the packet containing the string is lost, the server will not receive it at all. Therefore, modders should anticipate the possibility that a string might not be received and should try to rectify the problem if necessary.
Sends an ACS string from the server to the client(s), or from a client to the server, then executes a script on the receiver's end. If run offline, the script will be executed on the local machine like normal. Note that just like with RequestScriptPuke and NamedRequestScriptPuke, there is no guarantee that the server will receive the string from the client. If the packet containing the string is lost, the server will not receive it at all. Therefore, modders should anticipate the possibility that a string might not be received and should try to rectify the problem if necessary.


==Parameters==
=== Parameters ===
*script: The script to be run on the receiver's end upon receiving the string.
* ''script'': The script to be run on the receiver's end upon receiving the string.
*string: The string that will be sent across the network.
* ''string'': The string that will be sent across the network.
*client: If specified, the string will only be sent to this client. By default, this is -1 which means that all clients receive the string. This only matters when called by the server.
* ''client'': If specified, the string will only be sent to this client. By default, this is -1 which means that all clients receive the string. This only matters when called by the server.


== Return Value ==
=== Return value ===
Returns 1 if the string could be sent successfully, or 0 if wasn't. The function might explicitly fail for a couple of reasons:
Returns 1 if the string could be sent successfully, or 0 if wasn't. The function might explicitly fail for a couple of reasons:
* The script doesn't exist.
* The script doesn't exist.
Line 18: Line 18:
* If called on the client's end, the script doesn't have the <tt>NET</tt> flag.
* If called on the client's end, the script doesn't have the <tt>NET</tt> flag.


[[category:ACS Functions]]
== Examples ==
{{noexamples}}
 
[[category:ACS functions]]