Garry's Mod Wiki

OnRequestFullUpdate

Description

Called when a player requests a full update from the server.
Called Clientside when the Update is received or when another player requested a full update.

When this event is called the first time for a client, net messages will be reliably received by the client.
This gameevent is called twice for the player, because it is first called serverside and networked, but then also called clientside.

Members

string networkid
The SteamID the player has. Will be BOT for bots and STEAM_0:0:0 in single-player.
string name
The name the player has.
number userid
The UserID the player has.
number index
The EntIndex of the player, minus one.

Examples

Example

Early Networking Example

local Queue = {} hook.Add( "PlayerInitialSpawn", "EarlyNetworkingExample", function( ply ) Queue[ ply:UserID() ] = true end ) gameevent.Listen( "OnRequestFullUpdate" ) hook.Add( "OnRequestFullUpdate", "EarlyNetworkingExample", function( data ) local UID = data.userid -- Same as Player:UserID() if ( not Queue[ UID ] ) then return end Queue[ UID ] = nil -- Some networking here -- net.Start( 'YourCoolNetMessage' ) -- net.Send( Player( UID ) ) end )

Example

This is a basic template with the purpose of including all arguments / table variables to make it easily known which values can be accessed.

gameevent.Listen( "OnRequestFullUpdate" ) hook.Add( "OnRequestFullUpdate", "OnRequestFullUpdate_example", function( data ) local name = data.name // Same as Player:Nick() local steamid = data.networkid // Same as Player:SteamID() local id = data.userid // Same as Player:UserID() local index = data.index // Same as Entity:EntIndex() minus one // Called when a player requests a full update from the server. end )