This event is executed when a client receives a message from the server. The event_type variable is set to the type of the message. When the message contains a string, a pointer to the received string is handed over as parameter to the function.


There are 5 types of client events:
EVENT_JOIN A7.70 The client has successfully joined the session. A STRING pointer containing the server's level name is passed as the first argument.
EVENT_LEAVE A7.70 The client was dropped or has not received any server messages in 10 seconds. It was either intentionally disconnected by the server or the server was shut down. The connection is terminated.
EVENT_STRING The server has sent a STRING with send_string_to. The string pointer is passed as the first argument.
EVENT_VAR The server has sent a variable or struct with send_var_to. The address is passed as the first argument.
EVENT_DATA The server has sent a data buffer with send_data_to. The buffer address is passed as the first argument. The buffer is only valid during the event function and deallocated afterwards.

Example (lite-C):

TEXT* tMessage = { string(""); flags = SHOW; }

STRING* mystring = "Just some string";

function on_client_event(void* str)
  if ((event_type == EVENT_STRING) && (str == mystring)) 
 	  str_cpy((tMessage.pstring)[0],"STRING 'mystring' was just changed!"); 

See also:

on_server, send_string_to, send_var_to, send_data_to ► latest version online