An event occurs when attempting to connect to MyChat Server.

 

Event template


function OnClientConnect(iCID: integer; sIP: string; iMajorVer, iMinorVer: integer): boolean;
begin
  // your own code
  result := true;
end;
begin
end.


You can put your code instead of the comment.

 

Description of parameters

Parameter

Type

Value

iCID

integer

Connection ID of the client, unique session identifier in the online structure of network connections to the server;

sIP

string

IP address of the remote client;

iMajorVer

integer

client version (major);

iMinorVer

integer

client version (minor).

 

Return value

By default, the function must return True, however, if you decide to not let the connection to happen, it is possible to return False and then the client won't be allowed to connect to the server.

 

Example


function OnClientConnect(iCID: integer; sIP: string; iMajorVer, iMinorVer: integer): boolean;
begin
  if sIP = '192.168.10.23' then result := false
    else result := true;
end;
begin
end.


The script detects if a user with IP 192.168.10.23 connects — the server disables it automatically. The control over the event "OnClientConnect" allow more options for an administrator.

 

See also

OnUserLogin