Garry's Mod Wiki

Revision Difference

GM:PlayerSpray#528881

<function name="PlayerSpray" parent="GM" type="hook"> <ishook>yes</ishook> <description>Determines if the player can spray using the "impulse 201" console command.</description> <description>Determines if the player can spray using the `impulse 201` console command.</description> <realm>Server</realm> <predicted>No</predicted> <args> <arg name="sprayer" type="Player">The player</arg>⤶ <arg name="sprayer" type="Player">The player.</arg>⤶ </args> <rets> <ret name="" type="boolean">Return false to allow spraying, return true to prevent spraying.</ret> <ret name="" type="boolean">Return `false` to allow spraying, return `true` to prevent spraying.</ret> </rets> </function> <example> <description>Makes so that only Admins can spray.</description> <code> hook.Add( "PlayerSpray", "DisablePlayerSpray", function( ply ) return !ply:IsAdmin() return not ply:IsAdmin() end ) </code> ⤶ </example></example>