Due to the new functionality mentioned
here, you can now do this:
Code:
sub CheckGroupGlobal {
my $client = plugin::val('client');
my $global = shift;
my $value = shift;
if ($client->GetGroup()) {
for ($i = 0; $i < 6; $i++) {
if ($client->GetGroup()->GetMember($i) && $client->GetGroup()->GetMember($i)->GetGlobal($global) != $value) {
return 0;
}
}
} else {
if ($client->GetGlobal($global) != $value) {
return 0;
}
}
return 1;
}
sub SetGroupGlobal {
my $client = plugin::val('client');
my $global = shift;
my $value = shift;
my $options = shift;
my $duration = shift;
if ($client->GetGroup()) {
for ($i = 0; $i < 6; $i++) {
if ($client->GetGroup()->GetMember($i) && $client->GetGroup()->GetMember($i)->GetGlobal($global) != $value) {
$client->GetGroup()->GetMember($i)->SetGlobal($global, $value, $options, $duration);
}
}
} else {
if ($client->GetGlobal($global) != $value) {
$client->SetGlobal($global, $value, $options, $duration);
}
}
}
return 1;