MyChat add-ons: developing, technical questions, testing, documentation and other useful information
User avatar
Alona Kutsenko
The script works in MyChat v.6.0 and higher.

The task is to forbid a user to open dialogues with specified people but allow him to receive messages from them in a private conversation.

But, he is allowed to open private dialogues with others. How to make this work?

Create the event handling OnPrivateRequest on the server:

Code: Select all
function OnPrivateRequest(iCID, iUIN, iUINTo, iRole, iRoleReciever, iTask: integer): boolean;
begin
  if (iUIN = 6) and (iUINTo = 3) then begin
    mSendCustomMsgToClientConsoleByCID(iCID, 'You are not allowed to communicate with this person.' + CRLF +
                                             'Google why :)',
                                             'Error', true, true, 74);
    result := false;
  end else result := true;
end;

begin
end.

And do what you have to do. Simple and useful.