minetest.set_player_privs

From Minetest Developer Wiki
Jump to navigation Jump to search
Mbox warning.png This page contains unofficial, low-quality Lua API documentation and is likely to be outdated or wrong. Do not rely on it!
For the official and up-to-date documentation, see Lua API Documentation.
Mbox warning.png This page has been proposed for deletion for the following reason: "Contains unofficial and potentially outdated, redundant and inconsistent Lua API information"
If you don't think that this page should be deleted, please explain why on the talk page.

Syntax

<source>minetest.set_player_privs(name, privs)</source>

Description

Sets the privileges of the specified player.

  • name — name of the player of which to set the privileges
  • privs — a table containing the new privileges of the player. The keys are privilege names and the values are true. Privileges not specified are removed if the player had them before the call.

Examples

This code grants the “fly” privilege to Example Player without affecting the other privileges: <source> local playername = "Example Player" local privs = minetest.get_player_privs(playername) privs.fly = true minetest.set_player_privs(playername, privs) </source>

This code revokes the “fly” privilege from Example Player without affecting the other privileges: <source> local playername = "Example Player" local privs = minetest.get_player_privs(playername) privs.fly = nil minetest.set_player_privs(playername, privs) </source>

This code revokes all privileges from Example Player: <source> minetest.set_player_privs("Example Player", {}) </source>