Squirrel/Server/Functions/Sockets/Send
From Liberty Unleashed Wiki
(Difference between revisions)
(New page: __NOTOC__ This function sends the given data using a socket. == Syntax == <code>bool Socket.Send( string szData )</code> == Arguments == * '''szData''' - This is the data you want to s...) |
(→Example) |
||
Line 12: | Line 12: | ||
== Example == | == Example == | ||
− | |||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | + | function onPlayerText( player, text ) | |
+ | { | ||
+ | p_Socket.Send( "PRIVMSG #CHANNELNAME " + text + "\n" ); | ||
+ | } | ||
</code> | </code> | ||
+ | |||
+ | This would send the text that the player said to #CHANNELNAME if it was connected to an IRC server. p_Socket was created in the [[Squirrel/Server/Functions/Sockets/Connect|Connect]] function. | ||
=== Notes === | === Notes === | ||
− | + | The call [[Squirrel/Server/Events/Player/onPlayerText|onPlayerText]] 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:40, 8 March 2010
This function sends the given data using a socket.
Syntax
bool Socket.Send( string szData )
Arguments
- szData - This is the data you want to send via the socket as a string
Example
function onPlayerText( player, text ) { p_Socket.Send( "PRIVMSG #CHANNELNAME " + text + "\n" ); }
This would send the text that the player said to #CHANNELNAME if it was connected to an IRC server. p_Socket was created in the Connect function.
Notes
The call onPlayerText was used in in this example. More info about this in the corresponding page.