The function for disconnecting all online applications logged in on the server under the specified UIN.

 

As a rule, all MyChat applications — except MyChat WEB services (Kanban, forum, WEB chat, MyChat Guest, and Admin Panel) — automatically reconnect to the server after disconnection.

 

Syntax

function mKillUIN(iUIN: integer): integer;

 

Parameters and return values

Parameter

Type

Value

iUIN

integer

user's unique ID.

 

Function result

>0

All OK, a user is offline, the result is equal to the number of user's disconnected instances on the server;

-1

you can't disconnect the built-in bot UIN 0 from the server;

-2

UIN must be above zero;

-3

specified user is currently disconnected from the server (offline).

 

Example

The script for immediate disconnection of all online users on MyChat Server.


const
  STATE_ONLINE  = 0;
var
  sUsers: string;
  iUIN: integer;
begin
  sUsers := mGetUsersListByState(STATE_ONLINE);
  
    while length(sUsers) > 0 do begin
      iUIN := StrToIntDef(Fetch(sUsers, ','), -1);
      
        if iUIN > 0 then mKillUIN(iUIN);
    end;
end.


Script work result
[18:41:51] *** A user is disconnected from the server

 

See also

Fetch

Length

mGetUsersListByState

StrToIntDef

Created with the Personal Edition of HelpNDoc: From Word to ePub or Kindle eBook: A Comprehensive Guide