This Code won’t work.
I would do it like this.
var servergroupsOfUser = ev.client.getServerGroups();
function checkIfUserIsInGroup(servergroupsOfUser) {
var allserverIdsOfUser = new Array;
for (i = 0; i < servergroupsOfUser.length ; i++) {
allserverIdsOfUser.push(servergroupsOfUser.channel.id()
}
return allserverIdsOfUser;
}
if (checkIfUserIsInGroup(servergroupsOfUser).indexOf(insertAServergroupIdHere) >= 0) {
engine.log(„he is in the group“);
}
I can’t check if the code works, but I have working functions like this in some of my script, just check out my „servergroup switcher, and, or „admin % Moderator status“ script. There you should find good examples.