client_drop(STRING* name)

client_drop_id(var client_id)

Kicks a client out of the session.


0 if the client could not be found, nonzero otherwise.


name Client name as passed by the on_server join event.
client_id Client number as passed by the on_server join event, or stored in an ENTITY struct when it was created by a client.






This function can be used to install a security mechanism on the server, in order to prevent malicious client scripts to hack the session. A possible security mechanism could work as follows. The on_server join event waits for a string to be sent by the client after joining. That string contains the client name plus a password (possibly encrypted). If the string is not received after a certain time, or the name or password is not correct, the client is dropped. This allows only authorized clients to join a session.

Example (lite-C):

function on_server_event(STRING* name)
  if (EVENT_JOIN == event_type) {
    client_drop(name); // drop any joined client

See also:

send_string_id, send_var_id, on_server, client_find, str_for_id

► latest version online