Garry's Mod Wiki

Revision Difference

GM:PlayerCheckLimit#527437

<function name="PlayerCheckLimit" parent="GM" type="hook"> <ishook>yes</ishook> <description>Called whenever a player is about to spawn something to see if they hit a limit for whatever they are spawning.</description>⤶ <description>Called whenever a player is about to spawn something to see if they hit a limit for whatever they are spawning.⤶ <note>This hook will not be called in singleplayer, as singleplayer does not have limits.</note></description>⤶ <realm>Shared</realm> <added>2020.06.24</added> <args> <arg name="ply" type="Player">The player who is trying to spawn something</arg> <arg name="limitName" type="string">The limit's name</arg> <arg name="current" type="number">The amount of whatever player is trying to spawn that the player already has spawned</arg> <arg name="defaultMax" type="number">The default maximum count, as dictated by the `sbox_max<limitName>` convar on the server. This is the amount that will be used if nothing is returned from this hook.</arg> </args> <rets> <ret name="" type="boolean">Return `false` to indicate the limit was hit, or nothing otherwise</ret> </rets> </function>