Thread: Group Flagging.
View Single Post
  #1  
Old 06-01-2015, 09:46 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,589
Default Group Flagging.

This allows you to set and check whole groups flags. As it may not be obvious, this requires a custom file in your plugins folder.
Code:
sub CheckGroupFlag {
    my $client = plugin::val('client');
    my $flag = shift;
    if ($client->GetGroup()) {
        for ($i = 0; $i < 6; $i++) {
            if ($client->GetGroup()->GetMember($i) && !$client->GetGroup()->GetMember($i)->HasZoneFlag($flag)) {
                return 0;
            }
        }
    } else {
        if (!$client->HasZoneFlag($flag)) {
            return 0;
        }
    }
    return 1;
}

sub SetGroupFlag {
    my $client = plugin::val('client');
    my $flag = shift;
    if ($client->GetGroup()) {
        for ($i = 0; $i < 6; $i++) {
            if ($client->GetGroup()->GetMember($i) && !$client->GetGroup()->GetMember($i)->HasZoneFlag($flag)) {
                $client->GetGroup()->GetMember($i)->SetZoneFlag($flag);
            }
        }
    } else {
        if (!$client->HasZoneFlag($flag)) {
            $client->SetZoneFlag($flag);
        }
    }
}

return 1;
Reply With Quote