send_string (STRING*)
send_string_to (ENTITY*, STRING*)
send_string_id (var client_id, STRING*)
Updates the content of a STRING object from a client to the server,
or
from a server to all clients (send_string), to a client that has created a certain
entity (send_string_to), or LC to a client with a certain id number (send_string_id).
The on_server or on_client event
function is triggered on each PC which has received the string, and the old string
content is replaced by the new received string. This function can
be used for exchanging messages.
Parameters:
ENTITY* - Entity pointer, or NULL
for sending to all clients.
client_id - client number as received by the join event or stored in the
struct of a client-created entity (
see atypes.h).
STRING* - String to send.
Remarks:
- On the server this function sends
the string only to the client with the given client_id resp. the client that
has created the given entity. If NULL is given for the entity pointer,
the server sends the string to all clients.
- When executed on the client, the string is sent to the server and NULL
must be given for client_id or the entity pointer.
- The event function on the
receiving PC receives the address of the string as its first argument.
-
This function synchronizes scripts and can not be used in external languages such as C++ or C#,
or in unprotected sessions. Use send_data_to instead.
Edition:
C
Example:
result = inkey(message_str); // the user types a message on the server
if (result == 13) { // if [ENTER] pressed
send_string_to(NULL,message_str); // send that string to all players
} // message_str on all clients now contains the entered message
See also:
send_var, send_data_to,
session_connect,
on_server,
on_client
► latest
version online