share the value of a variable stored in the entity sv side file to the cl side
3 replies, posted
Hello ! I try to communicate the value of a variable from the server file of the entity to the client file of the entity but unfortunately I don't know how, could you help me please?
Example:
function ENT:Draw()
self:DrawModel()
cam.Start3D2D(SelfGetPos) , Angle(ang2.x,ang2.y + 180 ,ang2.z) , 0.3)
draw.SimpleText("Need:"..Variable,"CloseCaption_Bold",100,-90,Color(255,255,255),TEXT_ALIGN_CENTER ,TEXT_ALIGN_CENTER )
cam.End3D2D()
end
I would like to draw the value of a Variable in draw.SimpleText but I just can't figure out how to,
the variable is in the server side file of the entity.
I hope you could help me, thank you for reading!
I think you need to use the net. libary.
Info can be found on the wiki if you search for net
If the variable is a member of the entity, you can use the NWVar system. Have a look at Entity:NetworkVar() which goes in ENTITY:SetupDataTables().
If you want to create the variable on-the-fly, you can use Entity:SetNWString() or one of the others (for integers, booleans etc.).
Otherwise if the variable is not related to the entity you can use the Net Library as mentioned by @ImTiara .
Thanks you for your helps ! It worked !
Sorry, you need to Log In to post a reply to this thread.