Script event of MyChat Server: OnClientConnect
The event that occurs at the moment when the server receives the private message from one user to another.
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 up to the point (major); |
iMinorVer |
integer |
client version after the point (minor). |
Return value
By default this function should return the value "true". However, if you decide to forbid the client connection you can change the value to "false" and the client will be denied from 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 tracks the user if he is with the IP address 192.168.10.23 the server disconnects him automatically. Basically, such a feature of IP filtration already exists on the server, but the possibility to control the event "OnClientConnect" gives more solution freedom for an administrator.