isGM: Difference between revisions
Jump to navigation
Jump to search
(Player parameter not yet added) |
No edit summary |
||
Line 9: | Line 9: | ||
isGM() | isGM() | ||
</source> | </source> | ||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
isGM(player) | isGM(player) | ||
</source>'''Parameters''' | </source>'''Parameters''' | ||
{{param|player|player's name as a string to check if he is a GM or not.}} | {{param|player|player's name as a string to check if he is a GM or not.}} | ||
|examples= | |||
'''1. Test to see if current player is a GM.''' | |||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
I am a [r,if(isGM()): "GM"; "Player"] | I am a [r,if(isGM()): "GM"; "Player"] | ||
</source> | </source> | ||
<source lang="mtmacro" | |||
[ | '''2. Display a list of GMs.''' | ||
<source lang="mtmacro"> | |||
[H: allPlayers = getAllPlayerNames("json")] | |||
[H: GMList = "[]"] | |||
[H: foreach(player,allPlayers), code: { | |||
[H, if(isGM(player)): GMList = json.append(GMList,player)] | |||
}] | |||
[R, if(! json.isEmpty(GMList)): "GM List: " + json.toList(GMList); "No players are listed as GM"] | |||
</source> | </source> | ||
|changes= | |changes= | ||
* '''b91''' - Added {{code|player}} parameter}} | |||
[[Category:Permission Function]] | [[Category:Permission Function]] |
Revision as of 18:13, 7 November 2014
isGM() Function
• Introduced in version 1.3b48
Returns
true
(1
) if the player is a GM or false
(0
) if they are not.Usage
isGM()
isGM(player)
Parameters
player
- player's name as a string to check if he is a GM or not.
Examples
1. Test to see if current player is a GM.
I am a [r,if(isGM()): "GM"; "Player"]
2. Display a list of GMs.
[H: allPlayers = getAllPlayerNames("json")]
[H: GMList = "[]"]
[H: foreach(player,allPlayers), code: {
[H, if(isGM(player)): GMList = json.append(GMList,player)]
}]
[R, if(! json.isEmpty(GMList)): "GM List: " + json.toList(GMList); "No players are listed as GM"]
Version Changes
- b91 - Added
player
parameter