Entity:SetNWInt

From Garry's Mod
Jump to: navigation, search
 Entity:SetNWInt( )

Contents

Description

Sets a networked integer (whole number) value on the entity.

The value can then be accessed with Entity:GetNWInt both from client and server.

See Entity:SetNWFloat for numbers that aren't integers.

NOTE Running this function clientside will only set it for the client it is called on.

Arguments

string key

The key to associate the value with

Arguments

number value

The value to set

Examples

Example

This will set the networked integer 'money' on all clients to 100.

for k, v in pairs( player.GetAll() ) do
    v:SetNWInt( 'money', 100 )
end


Personal tools
Navigation