DViewList not working correctly with a networked variable
2 replies, posted
Hey everyone
I'm trying to make a system where when a physics prop is used (picked up), it adds its name to a DViewList along with the amount in the player has. The problem is, the name isn't showing up, and it has only run the function o
Here's the serverside code
[CODE]local function PlayerUse( ply, ent )
local enttype = ent:GetClass()
local entname = ent:GetName()
if ( enttype == "prop_physics" ) then
ent:Remove()
util.AddNetworkString( "EntityName" )
net.Start( "EntityName" )
net.WriteString( entname )
umsg.Start( "AddItem", ply )
umsg.End()
end
end
hook.Add( "PlayerUse", "Use Prop", PlayerUse )[/CODE]
Here's clientside
[CODE]function AddItem()
net.Receive( "EntityName", function( l, ply )
itemlist:AddLine( net.ReadString(), 1 )
end )
end
usermessage.Hook( "AddItem", AddItem )[/CODE]
Any help is appreciated
I sent you how to use net messages - read it.
[url]http://wiki.garrysmod.com/page/Net_Library_Usage[/url]
Explain to me how I didn't use them correctly please, the wiki isn't very specific
[editline]29th April 2016[/editline]
Thanks for the dumb tag, that was pretty helpful. :goodjob:
[editline]29th April 2016[/editline]
Turns out ent:GetName() is showing up blank, any fix?
Sorry, you need to Log In to post a reply to this thread.