• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] Grant Permission

Status
Not open for further replies.

Xele

Enthusiast
Grant Permission within C++

Hi there

i'm looking for a way to grant permission to player

Example:
Code:
class Noob_Player : public PlayerScript
{
    public:
        Noob_Player() : PlayerScript("Noob_Player") { }

    void OnLogin(Player* player)
    {
        if (player-GetSession->IsNoob)
            player->GetSession->AddGrantedPermission(1000);
    }
};
 
Last edited:

Tommy

Founder
Hi there

i'm looking for a way to grant permission to player

Example:
Code:
class Noob_Player : public PlayerScript
{
    public:
        Noob_Player() : PlayerScript("Noob_Player") { }

    void OnLogin(Player* player)
    {
        if (player-GetSession->IsNoob)
            player->GetSession->AddGrantedPermission(1000);
    }
};

What do you mean grant permission? RBAC permissions? You don't want to do that when the player logs in. When the player makes the account, that's when you add the permission to the RBAC table...
 

Xele

Enthusiast
yes rbac permissions, i know i can grant permissions with rbac tables, but i want done this within C++
 

Tommy

Founder
yes rbac permissions, i know i can grant permissions with rbac tables, but i want done this within C++

Why? It's pointless to do it in C++ when you should be handling this during account creation submission..
 

Xele

Enthusiast
i have hide something behind IsNoob Method :thumbupguy:, with this way makes my job much easier to do
 

ToxicDev

Banned
In my opinion it wouldn't really save you any time. Adding a db entry for that permission rather than adding a line of code to a script and then having to recompile seems a lot shorter. But by doing this it just means every time a player logs in its going to give that player the permissions during his login session meaning every time he logs in its going to have to do it again and think about it if you have 5-10 people logging in at the same time every so many seconds. Which you are likely to have if you're server is popular. It is going to be running this code over and over and over instead of it just reading the db and saying ok well they have this permission which it is already doing. So really your just wasting your time and making your server do something it is already doing by default. Use the database its not that bad.

As to your question I don't believe there is even a function to do this in trinity core. However if there is not a function for this it is possible to make one but I am not going to get into that or bother looking to see if there is a function for this. Considering the database already does this for you all you have to do is give your gm rank or account access to the permission.

Either way good luck with what ever you decide to do.
 

Xele

Enthusiast
thx for info, i found another way to do my job, just with a bool thing :cool (2):, im still learning C++
 
Status
Not open for further replies.
Top