MyChat add-ons: developing, technical questions, testing, documentation and other useful information
User avatar
Alona Kutsenko
The server's version is 7.0 and higher.

Use the event OnRegistered:

websup.png
Script to rename automatically WEB support users
websup.png (155.57 KiB) Viewed 13660 times

The script performs when a new user registers. It checks that this user has a default rights group "WEB guests". If yes, the script renames him by adding a prefix to his nickname "(websup)" from a text constant.

Script source
Code: Select all
// ---------------------------------------
// Script created by Alexey Pikurov
// 01.06.2018 15:33:51
// ---------------------------------------
const
  PREFIX = '(websup)';
 
procedure OnRegistered(iCID, iUIN: integer; var iRole: integer; var bBlocked: boolean);
var
  sGroupName, sNickName: string;
  x: integer;
begin
  sGroupName := mGetRoleNameByID(iRole);
 
    if sGroupName = 'WEB guests' then begin
      sNickName := mGetUserAttribute(iUIN, 'InternalNickName');
     
        if pos(PREFIX, sNickName) = 0 then mSetUserAttribute(iUIN, 'InternalNickName', PREFIX + ' ' + sNickName);
    end;
end;

begin

end.