Garry's Mod Wiki

Revision Difference

GM:CanPlayerSuicide#560243

<function name="CanPlayerSuicide" parent="GM" type="hook"> <description>Determines if the player can kill themselves using the concommands `kill` or `explode`.</description> <realm>Server</realm> <args> <arg name="player" type="Player">The player</arg> </args> <rets> <ret name="" type="boolean">True if they can suicide.</ret> </rets> </function> <example> <description>Makes suiciding only accessible for super admins.</description> <code> hook.Add( "CanPlayerSuicide", "AllowOwnerSuicide", function( ply ) return ply:IsSuperAdmin()⤶ if not ply:IsSuperAdmin() then⤶ return false⤶ end⤶ end ) </code> </example>