Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

[DEV] GroupHandlerAPI


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
Group Handler API

This API allows developers to append groups to players instead of worrying about getting their adminId and reapplying it every time the cache is rebuilt. sm_reloadadmins will reapply the groups that are registered to users. Mapchanges and player disconnects clears the cache, however you should be using OnClientPostAdminCheck to assign the group anyways.

The Groups can also be normal admin groups set within Sourcebans or admin_groups.cfg, allowing server operators to completely customize what flags or access that group is allowed.

CheckCommandAccess can be properly used with this api as all groups registered are given the override of the group name.

Since this uses admin groups as a developer you no longer have to worry about adding or removing flags from a user, however you cannot properly delete a group from a user without unassigning their group and using DumpAdminCache().

This was created because I wanted several plugins to essentially do the same thing and kind of flew with the idea in order to allow creating those separate plugins not worry about the flag assigning issue.

More information

Example Plugin:
Code:

char myGroupNames[5][] = {
    "Group #1",
    "Group #2",
    "Group #3",
    "Group #4",
    "Cool Group"
};

public void OnClientPostAdminCheck(int client) {
    int groupNum = 1; // * Does some kind of awesome calls to some kind of database some where to set this *
   
    //Only assigns the player to this group if it exists, wont create the group.
    // Be warned though, if you're creating the group within your plugin then assign the player it'll stick.
    // So make sure that you use the forward for whenever a new group is created instead.
    GroupHandler_Assign(client, myGroupNames[0], false);
   
    //Assign the player to the group
    if(groupNum >= 0 && groupNum < 5) {
        //Only add in if the groupNum
        GroupHandler_Assign(client, myGroupNames[groupNum]);
    }
}

public void GroupHandler_GroupCreated(char[] groupName, GroupId groupId) {
    //Called if the group wasn't found and was created as a temp group
   
    if(StrEqual(groupName, "Cool Group")) {
        groupId.SetFlag(Admin_Custom4, true);
    }
}

Releases (Plugin)
GitHub (Source)

Wyświetl pełny artykuł

Odnośnik do komentarza
Udostępnij na innych stronach

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.

Zarejestruj nowe konto

Załóż nowe konto. To bardzo proste!

Zarejestruj się

Zaloguj się

Posiadasz już konto? Zaloguj się poniżej.

Zaloguj się
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...