Gmod Lua help [Auto updating prop with text on it]
2 replies, posted
Hello, I managed to make a menu and entity, The entity is the issue here since the menu works fine basically.
I change a value in the menu and it updates on the entity but it needs to have the lua file reloaded for it to actually update ingame.
Ignore the nil, I havn't done those ones yet but this is it before I change them through the menu.
https://files.facepunch.com/forum/upload/170301/0ceda19d-0a1d-4ff5-b27a-4f7dc89fe4a0/image.png
Okay so now I change it in the menu and get this
https://files.facepunch.com/forum/upload/170301/492ae4e2-cd49-4266-9a7d-24ee07874069/image.png
however when I refresh the lua it shows exactly what i want it to see it just doesn't update it when i apply it through the ingame menu.
If you could help me I would appreciate that here is the code for this item [this is the cl_init and its the only file that fixes the blank spots when ran again]
include('shared.lua')
net.Receive( "regconb1", function()
regconb1 = net.ReadString()
end )
net.Receive( "regconb2", function()
regconb2 = net.ReadString()
util.NetworkStringToID(regconb2)
end )
regconb1 = bookregi1
regconb2 = bookregi2
function ENT:Draw()
local dist = (LocalPlayer():GetShootPos() - self.Entity:GetPos()):Length()
if (dist > 750) then return end
self:DrawModel()
local ab = Vector(2,-5,35) -- position offset
local ab2 = Angle(180,270,-90) -- angle offset
local scaleab = 0.6
local mh1 = Vector(2,-10,20) -- position offset
local mh12 = Angle(180,270,-90) -- angle offset
local mh2 = Vector(2,-10,10) -- position offset
local mh22 = Angle(180,270,-90) -- angle offset
local er = Vector(2,-10,0) -- position offset
local er2 = Angle(180,270,-90) -- angle offset
local tb = Vector(2,-10,-10) -- position offset
local tb2 = Angle(180,270,-90) -- angle offset
local rb = Vector(2,-10,-20) -- position offset
local rb2 = Angle(180,270,-90) -- angle offset
local scale = 0.45
local b1 = Vector(2,23,19) -- position offset
local b12 = Angle(180,270,-90) -- angle offset
local b2 = Vector(2,23,9) -- position offset
local b22 = Angle(180,270,-90) -- angle offset
local b3 = Vector(2,23,-1) -- position offset
local b32 = Angle(180,270,-90) -- angle offset
local b4 = Vector(2,23,-11) -- position offset
local b42 = Angle(180,270,-90) -- angle offset
local b5 = Vector(2,23,-21) -- position offset
local b52 = Angle(180,270,-90) -- angle offset
local scaleb = 0.4
cam.Start3D2D(self:LocalToWorld(ab), self:LocalToWorldAngles(ab2), scaleab)
draw.DrawText("Area Bookings", "Trebuchet24", 0,0, Color(0,0,255), TEXT_ALIGN_CENTER)
cam.End3D2D()
cam.Start3D2D(self:LocalToWorld(mh1), self:LocalToWorldAngles(mh12), scale)
draw.DrawText("Main Hanger 1 - [ ]", "Trebuchet24", 0,0, Color(255,255,255), TEXT_ALIGN_CENTER)
cam.End3D2D()
cam.Start3D2D(self:LocalToWorld(mh2), self:LocalToWorldAngles(mh22), scale)
draw.DrawText("Main Hanger 2 - [ ]", "Trebuchet24", 0,0, Color(255,255,255), TEXT_ALIGN_CENTER)
cam.End3D2D()
cam.Start3D2D(self:LocalToWorld(er), self:LocalToWorldAngles(er2), scale)
draw.DrawText("Engine Room - [ ]", "Trebuchet24", 0,0, Color(255,255,255), TEXT_ALIGN_CENTER)
cam.End3D2D()
cam.Start3D2D(self:LocalToWorld(tb), self:LocalToWorldAngles(tb2), scale)
draw.DrawText("Tie Bays - [ ]", "Trebuchet24", 0,0, Color(255,255,255), TEXT_ALIGN_CENTER)
cam.End3D2D()
cam.Start3D2D(self:LocalToWorld(rb), self:LocalToWorldAngles(rb2), scale)
draw.DrawText("Repair Bays - [ ]", "Trebuchet24", 0,0, Color(255,255,255), TEXT_ALIGN_CENTER)
cam.End3D2D()
cam.Start3D2D(self:LocalToWorld(b1), self:LocalToWorldAngles(b12), scaleb)
draw.DrawText(tostring(regconb1), "Trebuchet24", 0,0, Color(255,0,0), TEXT_ALIGN_CENTER)
cam.End3D2D()
cam.Start3D2D(self:LocalToWorld(b2), self:LocalToWorldAngles(b22), scaleb)
draw.DrawText(tostring(regconb2), "Trebuchet24", 0,0, Color(255,0,0), TEXT_ALIGN_CENTER)
cam.End3D2D()
cam.Start3D2D(self:LocalToWorld(b3), self:LocalToWorldAngles(b32), scaleb)
draw.DrawText(tostring(regconb3), "Trebuchet24", 0,0, Color(255,0,0), TEXT_ALIGN_CENTER)
cam.End3D2D()
cam.Start3D2D(self:LocalToWorld(b4), self:LocalToWorldAngles(b42), scaleb)
draw.DrawText(tostring(regconb4), "Trebuchet24", 0,0, Color(255,0,0), TEXT_ALIGN_CENTER)
cam.End3D2D()
cam.Start3D2D(self:LocalToWorld(b5), self:LocalToWorldAngles(b52), scaleb)
draw.DrawText(tostring(regconb5), "Trebuchet24", 0,0, Color(255,0,0), TEXT_ALIGN_CENTER)
cam.End3D2D()
end
If you can help me figure this out I will <3 you forever
What about this?
regconb1 = bookregi1
regconb2 = bookregi2
What does those lines doing here?
they are telling the drawtext tostring what regconb1 is outputted as on the client side derma menu
cam.Start3D2D(self:LocalToWorld(b1), self:LocalToWorldAngles(b12), scaleb)
draw.DrawText(tostring(regconb1), "Trebuchet24", 0,0, Color(255,0,0), TEXT_ALIGN_CENTER)
cam.End3D2D()
Sorry, you need to Log In to post a reply to this thread.