MyChat Scripts Engine: mAddUserToGroup
Function to add a specified user to a specified group.
Syntax
function mAddUserToGroup(iUIN: integer; sGroupName: string): integer;
Parameters and return values
Parameter |
Type |
Value |
iUIN |
integer |
unique numeric user ID; |
sGroupName |
string |
users group name. The letter case is important. |
Function result
0 |
user was added to a group successfully; |
-1 |
such user does not exist; |
-2 |
group with this name does not exist; |
-3 |
user already exists in this group. |
Example
const
USER = 6;
GROUP_NAME = 'Test Group';
var
x: integer;
s: string;
begin
mCreateUsersGroup(GROUP_NAME);
x := mAddUserToGroup(USER, GROUP_NAME);
case x of
0: s := 'all ok';
-1: s := 'user doesn''t exist';
-2: s := 'group doesn''t exist';
-3: s := 'user is already in the group';
end;
mLogScript(s, '');
end.
Script work result
[19:07:38] (Log "mAddUserToGroup"): all ok
[19:07:38] (Run "mAddUserToGroup"): Script operation time: 13 ms
[19:07:38] (Run "mAddUserToGroup"): Script done successfully.