ENT.UpdateTransmitState

From GMod Wiki

Jump to: navigation, search
Warning 64 severe.pngThis page has multiple issues.
See the Page Details section for information.


Event Hook
Hook NameUpdateTransmitState
SyntaxENT:UpdateTransmitState( )
DescriptionSets the transmit state of Networked Vars of an Entity
ReturnsEnumeration_List:Transmit(Enumeration_List:Transmit)
Lua StateNewerServer.png
BBCode[b][url=wiki.garrysmod.com/?title=ENT.UpdateTransmitState]ENT.UpdateTransmitState [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionN/A
Used onNewerServer.png
Code
function ENT:UpdateTransmitState() return TRANSMIT_ALWAYS end; 
OutputN/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

Page Details

Mess.pngThis 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.
Warning 64.pngThis 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.
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox