Garry's Mod Wiki

Revision Difference

ENTITY:UpdateTransmitState#518295

<function name="UpdateTransmitState" parent="ENTITY" type="hook"> <ishook>yes</ishook> <description>Called whenever the transmit state should be updated.</description> <realm>Server</realm> <predicted>No</predicted> <rets> <ret name="" type="number">Transmit state to set, see <page>TRANSMIT</page>.</ret> </rets> </function> <example> <description>Entity pickup example, stops the entity from being networked after it's been picked up, and restores it once it "respawns".</description> <code> function ENT:Touch( other ) if ( self.NextRespawn &amp;gt; CurTime() ) then return end if ( self.NextRespawn &gt; CurTime() ) then return end self.NextRespawn = CurTime() + 5 self:AddEFlags( EFL_FORCE_CHECK_TRANSMIT ) end function ENT:UpdateTransmitState() if ( self.NextRespawn &amp;gt; CurTime() ) then if ( self.NextRespawn &gt; CurTime() ) then return TRANSMIT_NEVER end return TRANSMIT_PVS end function ENT:Think() if ( self.NextRespawn != -1 &amp;&amp; self.NextRespawn &amp;lt; CurTime() ) then if ( self.NextRespawn != -1 && self.NextRespawn &lt; CurTime() ) then self.NextRespawn = -1 self:AddEFlags( EFL_FORCE_CHECK_TRANSMIT ) end end </code> </example>