ENT.UpdateTransmitState
From GMod Wiki
This page has multiple issues. See the Page Details section for information. |
Event Hook | |
Hook Name | UpdateTransmitState |
Syntax | ENT:UpdateTransmitState( ) |
Description | Sets the transmit state of Networked Vars of an Entity |
Returns | (Enumeration_List:Transmit) |
Lua State | |
BBCode | [b][url=wiki.garrysmod.com/?title=ENT.UpdateTransmitState]ENT.UpdateTransmitState [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | N/A |
---|---|
Used on | |
Code | function ENT:UpdateTransmitState() return TRANSMIT_ALWAYS end; |
Output | N/A |
Description
Lets say, you are spawning a SENT somewhere, where a player can't see it. Now, the SENT triggers ( e.g. Entity:SetNWInt(1) ). Sadly, the user won't get this NWInt send to his game because TRANSMIT_PVS is the default value.
Changing TRANSMIT_PVS to TRANSMIT_ALWAYS will send the updated NWInt no matter if a player sees this or not.
Further more, triggering Entity:SetNWInt(1) multiple times with TRANSMIT_ALWAYS will always force the server to send the data to the client, even if the value (here it is 1) hasn't changed. If it's TRANSMIT_PVS, the server will only send this value, if it changed.
This can run into trouble, like so: The SENTs have been spawned and NWInt is getting set to 1. Now a player connects to a server. He will not see the value as 1, even if the SENT is resending it. Only, if the value changes (e.g. NWInt is set to 2, previously 1), will the player recognize this being 2.
Return Value
- TRANSMIT_PVS - Only send when in the PVS (aka in Players View) - The default value
- TRANSMIT_ALWAYS - Always Send
- TRANSMIT_NEVER - Never Send
Page Details
This page has been deemed a mess. It may contain unnecessary information or be poorly organized. You can discuss changes on this article's talk page. |
This page needs to be edited as it contains information that is unclear or incorrect. Improvement can be discussed on the talk page. Find more pages that need work here. Details: None given. |