Garry's Mod Wiki

Entity:SetNWInt

void Entity:SetNWInt( string key, number value )

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.

Running this function clientside will only set it for the client it is called on.
This function will not round decimal values as it actually networks a float internally.

Arguments

1 string key
The key to associate the value with
2 number value
The value to set

Example

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

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

Page Links


Special Pages


Wikis

?

Render Time: 30ms

Session 0
DB GetPage 4
Generate Html 2
SaveChanges 9
Render Body 0
Render Sidebar 12