Squirrel/Server/Functions/Sockets/SendClient

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: __NOTOC__ This function sends the given data using a socket. == Syntax == <code>bool Socket.SendClient( string data, int connection )</code> == Arguments == * '''data''' - This is the ...)
 
(Example)
Line 13: Line 13:
 
== Example ==
 
== Example ==
  
{{Squirrel/NeedsExample}}
 
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onPlayerChat( player, text )
 +
{
 +
p_Socket.Send( text, 0 );
 +
}
 
</code>
 
</code>
 +
 +
This would send the text that the player said to connection id 0. p_Socket was created in the [[Squirrel/Server/Functions/Sockets/Connect|Connect]] function.
  
 
=== Notes ===
 
=== Notes ===
  
-- Example notes/used functions here
+
The call [[Squirrel/Server/Events/Player/onPlayerChat|onPlayerChat]] was used in in this example. More info about this in the corresponding page.
  
 
== Related Functions ==
 
== Related Functions ==
  
 
{{Squirrel/Server/Functions/Sockets}}
 
{{Squirrel/Server/Functions/Sockets}}

Revision as of 03:42, 8 March 2010

This function sends the given data using a socket.

Syntax

  1. bool Socket.SendClient( string data, int connection )

Arguments

  • data - This is the data you want to send via the socket as a string
  • connection - The ID of the client you wish to send data for

Example

  1.  
  2. function onPlayerChat( player, text )
  3. {
  4. p_Socket.Send( text, 0 );
  5. }
  6.  

This would send the text that the player said to connection id 0. p_Socket was created in the Connect function.

Notes

The call onPlayerChat was used in in this example. More info about this in the corresponding page.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox