Privileges allow server owners to grant or revoke the right to do certain
- When should a priv be used?
- Checking for privileges
- Getting and Setting
When should a priv be used?
A privilege should give a player the right to do something.
They are not for indicating class or status.
The main admin of a server (the name set by the
name setting) has all privileges
given to them.
- area_admin - admin functions of one mod is ok
Declaring a privilege
give_to_singleplayer is true, then you can remove it as that’s the default
value when not specified:
Checking for privileges
There is a quicker way of checking that a player has all the required privileges:
has is true if the player has all the privileges needed.
has is false, then
missing will contain a dictionary
of missing privileges[checking needed].
Getting and Setting
You can get a table containing a player’s privileges using
This works whether or not a player is logged in.
Running that example may give the following:
To set a player’s privs, you use
To grant a player some privs, you would use a mixture of those two:
Adding privileges to basic_privs
Workaround / PR pending
This is a workaround for a missing feature.
I have submitted a
pull request / patch
to make it so you don't need to edit builtin to add a priv to basic_privs.
To allow people with basic_privs to grant and revoke your priv, you’ll
need to edit
In both grant and revoke, change the following if statement:
For example, to add vote: