Function to obtain the network number of the online client connection by its UIN.
function mGetUserCID(iUIN: integer): integer;
Parameter |
Type |
Value |
---|---|---|
iUIN |
integer |
unique user identifier, which CID you need to determine. |
-1, if the user is disconnected from the server, and the positive number that equals to user CID, if he is online.
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.
[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.