MyChat Scripts Engine: mGetUserCID

MyChat Scripts Engine: mGetUserCID

Function to obtain the network number of the online client connection by its UIN.

 

Syntax

function mGetUserCID(iUIN: integer): integer;

 

Parameters and return values

Parameter

Type

Value

iUIN

integer

unique user identifier, which CID you need to determine.

 

Function result

-1, if the user is disconnected from the server, and the positive number that equals to user CID, if he is online.

 

Example

const
  iUIN = 6; // user UIN for test, set your own number
var
  iCID: integer;
  sNickName: string;
begin
  iCID := mGetUserCID(iUIN);
  
    if  iCID = -1 then mLogScript('UIN' + inttostr(iUIN) + ' is offline or not found', '')
      else begin
        sNickName := mGetUserAttribute(iUIN, 'InternalNickName');
        mLogScript('User "' + sNickName + '" is online, CID=' + inttostr(iCID), '');  
      end;
end.

Script work result

[17:14:10] (Log "mGetUserCID"): User "(Hobit)" is online, CID=1

[17:14:10] (Run "mGetUserCID"): Script operation time: 13 ms

[17:14:10] (Run "mGetUserCID"): Script operation time.

 

See also

IntToStr

mGetUserAttribute

mLogScript