Getting a user rights group name by his UIN.

 

Syntax

function mGetUserRoleName(iUIN: integer): string;

 

Parameters and return values

Parameter

Type

Value

iUIN

integer

unique user ID.

 

Function result

User rights group name, if he exists. If you specify an invalid UIN, the function returns an empty string.

 

Example
Calculating the number of users in "Guests" and "WEB quests".

var 
  sRoleName: string;
  i, iMaxUIN, iGuestsCount, iWEBGuestsCount: integer;
begin
  iMaxUIN         := mGetMaxRegisteredUIN;
  iGuestsCount    := 0;
  iWEBGuestsCount := 0;
  
  mLogScript('Max registered UIN: ' + inttostr(iMaxUIN), '');
  
    for i := 1 to iMaxUIN do
      if mIsUINExists(i) then begin
        sRoleName := mGetUserRoleName(i);
          if sRoleName = 'Guests' then inc(iGuestsCount) else
          if sRoleName = 'WEB guests' then inc(iWEBGuestsCount);
      end;
      
  mLogScript('Guests count: ' + inttostr(iGuestsCount), '');
  mLogScript('WEB Guests count: ' + inttostr(iWEBGuestsCount), '');
end.

Script work result

[17:16:28] (Log "mGetUserRoleName"): Max registered UIN: 15868

[17:16:28] (Log "mGetUserRoleName"): Guests count: 3985

[17:16:28] (Log "mGetUserRoleName"): WEB Guests count: 927

[17:16:28] (Run "mGetUserRoleName"): Script operation time: 706 ms

[17:16:28] (Run "mGetUserRoleName"): Script done successfully.

 

See also

IntToStr

mGetMaxRegisteredUIN

mLogScript