Garry's Mod Wiki

Revision Difference

Player:IsAdmin#518024

<function name="IsAdmin" parent="Player" type="classfunc"> <description>Returns whether the player is an admin or not</description> <realm>Shared</realm> <file line="5-L14">lua/includes/extensions/player_auth.lua</file> <rets> <ret name="" type="boolean">True if the player is an admin</ret> </rets> </function> <example> <description>Every time a player spawns, print in the console whether they are an admin.&amp;lt;!-- Untested yet, will test in a few minutes --&amp;gt;</description> <description>Every time a player spawns, print in the console whether they are an admin.&lt;!-- Untested yet, will test in a few minutes --&gt;</description> <code> hook.Add("PlayerSpawn", "PrintIfAdmin", function( ply ) if ( ply:IsAdmin() ) then print( "It's true, " .. ply:Nick() .. " is an admin") else print( "It's false, " .. ply:Nick() .. " is not an admin") end end ) </code> <outputfixedwidth>Fixed width</outputfixedwidth> <output> It's true, Alice is an admin. It's false, Bob is not an admin. </output> </example>