minetest.set_player_privs

From Minetest Developer Wiki
Jump to navigation Jump to search

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>