Garry's Mod Wiki

Revision Difference

ENTITY:Think#527618

<function name="Think" parent="ENTITY" type="hook"> <ishook>yes</ishook> <description> Called every frame on the client. Called every tick on the server. <note>By default, it runs about 5-6 times per second on the server, but you can force it to run at servers tickrate using the example below.</note> </description> <realm>Shared</realm> <predicted>No</predicted> <rets> <ret name="" type="boolean">Return true if you used <page>Entity:NextThink</page> to override the next execution time.</ret> </rets> </function> <example> <description> Force the think hook to run at the maximum frequency. This is generally only used for anim entities, if the entity has to play any animations. This is generally only used for `anim` type entities, if the entity has to play model animations/sequences. </description> <code> ENT.AutomaticFrameAdvance = true -- Must be set on client function ENT:Think() -- Do stuff self:NextThink( CurTime() ) return true self:NextThink( CurTime() ) -- Set the next think to run as soon as possible, i.e. the next frame. return true -- Apply NextThink call end </code> </example>