User Tools

Site Tools


dev:core:funref:is_creative

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
dev:core:funref:is_creative [2019-10-02 17:19]
82.67.173.193
dev:core:funref:is_creative [2019-10-02 20:18]
82.67.173.193 convert tabs to spaces
Line 11: Line 11:
 ===== Parameters ===== ===== Parameters =====
   * ''name'' //(string)//: the player name. It does not need to be logged in, but it *needs* to exist in the ''auth.txt'' file.   * ''name'' //(string)//: the player name. It does not need to be logged in, but it *needs* to exist in the ''auth.txt'' file.
 +
 +===== Returns =====
 +True if the creative mode is enabled for the player, false otherwise.
  
 ===== Errors and warnings ===== ===== Errors and warnings =====
Line 36: Line 39:
 <file lua is_creative.lua> <file lua is_creative.lua>
 function advtrains.is_creative(name) function advtrains.is_creative(name)
-        if not name then +    if not name then 
-                error("advtrains.is_creative() called without name parameter!"+        error("advtrains.is_creative() called without name parameter!"
-        end +    end 
-        if minetest.check_player_privs(name, {creative=true}) then +    if minetest.check_player_privs(name, {creative=true}) then 
-                return true +        return true 
-        end +    end 
-        return minetest.settings:get_bool("creative_mode")+    return minetest.settings:get_bool("creative_mode")
 end end
 </file> </file>
dev/core/funref/is_creative.txt · Last modified: 2020-01-22 10:53 by admin