So, I have a few problems with this code.
1: It overloads and shutdowns, but that's not the main problem, I just didn't look into fixing it because of the second problem.
2: For some reason, the "if" argument near the end, that checks the "on" variable doesn't give me ANYTHING. Tried with a simple "else", tried with an "elseif On == 0", doesn't work, returns something that makes the render completely visible, not even at 200 Alpha.
Also, thank you to Black and Ia for trying to help me.
--@name Field Door HP
--@author TheNextDecade
--@sharedscreen
function Drawer(posy,posx,col,hp)
render.setColor(col[1]-100,col[2]-100,col[3]-100,col[4])
render.drawFilledCircle(60,63,22,22)
render.setColor(col[1]-150,col[2]-150,col[3]-150,col[4])
render.drawCircle(60,63,22,22)
render.setColor(col[1],col[2],col[3],col[4])
local Perc = 40/100*hp
render.drawRect(55,43,10,Perc)
render.drawRectOutline(55,43,10,40)
end
if SERVER then
wire.createInputs({"Active","HP"},{"normal","normal"})
hook("input","ActiveChange",function(Input,Value)
if Input == "Active" then
if net.start() then
net.setDTVar("Int", 1, Value)
net.broadcast()
end
end
end)
else
hook("net","RecieveString",function(Length)
On = net.getDTVar("Int",1)
end)
Itself = entself()
if On == 1 then
local Alpha = 200
elseif On == 0 then
local Alpha = 1
end
hook("render","Render",function()
render.start3D2D(Itself:pos(),Itself:ang(),1)
render.clear()
Drawer(60,63,{150,250,150,Alpha},100)
render.end3D2D()
end)
end