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
dev:core:funref:is_creative [2019-10-02 17:15]
82.67.173.193 correct parameter name is "name"
dev:core:funref:is_creative [2020-01-22 10:53] (current)
admin ↷ Page moved from reference:advtrains:is_creative to dev:core:funref:is_creative
Line 10: Line 10:
  
 ===== Parameters ===== ===== Parameters =====
-  * ''playername'' //(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 =====
-It gives an error if the ''playername'' parameter is nil:+It gives an error if the ''name'' parameter is nil:
  
 > 2019-01-01 15:00:00: Error[Server]:  advtrains.is_creative() called without name parameter! > 2019-01-01 15:00:00: Error[Server]:  advtrains.is_creative() called without name parameter!
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.1570029345.txt.gz · Last modified: 2019-10-02 17:15 by 82.67.173.193