Garry's Mod Wiki

Entity:SetNetworkVarsFromMapInput

  boolean Entity:SetNetworkVarsFromMapInput( string name, string param )

Recently Added

This was recently added in version (2025.03.18). It might only be available on the Dev Branch right now.

Description

A helper function to allow setting Network Variables via Entity:Fire, primarily to allow mappers to set them from Hammer via Map I/O logic.

Meant to be called from ENTITY:AcceptInput, see example.

See also Entity:SetNetworkKeyValue for a function that does similar thing, but for entity key-values in Hammer instead.

This function will only work on entities which had Entity:InstallDataTable called on them, which is done automatically for players and all Scripted Entities.

Arguments

1 string name
The name of the Map I/O input, including the Set prefix.
2 string param
The input parameter.

Returns

1 boolean
Whether a network variable was set successfully

Example

Example usage, adding this will allow mappers to set all your networks vars using Map I/O inputs. You will also need to provide manually crafted .fgd file that lists all the key values. env_skypaint can be used as an example (garrysmod.fgd and env_skypaint.lua in base gamemode).

function ENT:AcceptInput( name, activator, caller, data ) if ( self:SetNetworkVarsFromMapInput( name, data ) ) then return true -- Accept the input so the there are no warnings in console with developer 2 end -- Other code... end