• Using Entity(self) inside of Panel
    2 replies, posted
Hi, i'm currently Learning how to interact between Server and Client side, i need to use self value(Entity) inside of Panel. As you guys know, Panel also uses self, so it makes name collision. so what i did is, Using net.Library to send Data to Client side "Panel", not just Entity. https://files.facepunch.com/forum/upload/138146/5e114eae-58b8-4aac-8a58-ed28926021f5/image.png Left = ClientSide, right = Serverside https://files.facepunch.com/forum/upload/138146/64dd5ec3-0578-42ad-a938-1ecda7c2eb05/image.png https://files.facepunch.com/forum/upload/138146/31fb5ca2-ef60-4c39-85bd-29fc6aa284f8/image.png so basically, self value of Entity is already used by another net channel(?) as you can see the codes, i'm very new to GLua(it's been 2 Weeks) https://files.facepunch.com/forum/upload/138146/04e0d88f-ac56-4c92-a25d-ab31927a357d/image.png As i expected, it makes Error. Error Code : ConfInfoLabel.Paint = function(self) -- self is already used by panel drawCircle(305, 75, 0, 60, (0.0036)*SvDataRcvd[6], Color(150, 125, 40, 200)) -- This Part drawCircle(305, 75, 0, 60, 360, 40, Color(50, 50, 50, 240) ) end Panel uses self value it self, so i... have no idea how to access Entity's value inside of Panel. [ERROR] addons/example_printer/lua/entities/example_printer/cl_init.lua:116: attempt to perform arithmetic on local 'rad' (a table value)   1. drawCircle - addons/example_printer/lua/entities/example_printer/cl_init.lua:116    2. unknown - addons/example_printer/lua/entities/example_printer/cl_init.lua:393 i know i'm doing working on hard stuff even i'm newbie, but i wanna challange my self. so can anyone tell me how to solve this problem? already understood about Serverside and Clientside and Shared.
Please, read Networking Entities. I don't understand what are you doing with this tables in net.Receive. There is no rad variable used in that Label.Paint function.
Thanks for the Link! just basic calculation result sends to Client side, and Draw them. rad value is now for Label.Paint, it's for drawCircle Which is : local function drawCircle(x, y, ang, seg, p, rad, color) local cirle = {} table.insert( cirle, { x = x, y = y} ) for i = 0, seg do local a = math.rad( ( i / seg ) * -p + ang ) table.insert( cirle, { x = x + math.sin( a ) * rad, y = y + math.cos( a ) * rad } ) end surface.SetDrawColor( color ) draw.NoTexture() surface.DrawPoly( cirle ) end rad need to be single number value but i inserted table value xd but i already said it in main thread. anyway, i'll take a look Networking Entities page. Thanks for reply!
Sorry, you need to Log In to post a reply to this thread.