Ok so im working on something for my server, its a food and hunger script, But when running it clientside it open the hud displkays and it works, or atleast what i have done of it, but for some reason now when i put iot in autorun/client on my server nowthing happens ? Anyw help please :
[CODE]local Hunger = 1
local Thirst = 75
SX=ScrW()
SY=ScrH()
--[[FONT]]--
surface.CreateFont( "OVERFHUDF", {
font = "Default",
size = ScreenScale(8),
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
} )
surface.CreateFont( "OVERFHUDF2", {
font = "Default",
size = ScreenScale(50),
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
} )
surface.CreateFont( "OVERFHUDF3", {
font = "Default",
size = ScreenScale(20),
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
} )
--[[HOOKS]]--
hook.Add("HUDPaint","OVERFoodHUDHook",OVERFoodHUD)
hook.Add("Think","CalculateFH",hungerFood)
function hungerFood()
if(LocalPlayer():Alive()==true) then
Hunger=Hunger-0.004
Thirst=Thirst-0.006
else
Hunger=75
Thirst=75
end
end
function getOFHunger()
return Hunger
end
function getOFThirst()
return Thirst
end
function OVERFoodHUD()
--HUD Draw code goes here
--HUD Color checking
HungerColor=Color(255-((Hunger/100)*255),0,(Hunger/100)*255,255)
ThirstColor=Color(255-((Thirst/100)*255),0,(Thirst/100)*255,255)
--Hunger checking
local HungerBar = ((Hunger/100)*ScreenScale(96))
local ThirstBar = ((Thirst/100)*ScreenScale(96))
--HUNGER
draw.RoundedBox(0,0,0,ScreenScale(100),ScreenScale(15),Color(20,20,20,200)) --Background Box
draw.RoundedBox(0,ScreenScale(2),ScreenScale(2),ScreenScale(96),ScreenScale(11),Color(0,0,0,255)) --Hunger Bar Background
draw.RoundedBox(0,ScreenScale(2),ScreenScale(2),HungerBar,ScreenScale(11),HungerColor) --Hunger Bar
draw.SimpleText("HUNGER","OVERFHUDF",ScreenScale(100/2),ScreenScale(15/2),Color(255,255,255),1,1) --Text
--THIRST
draw.RoundedBox(0,SX-ScreenScale(100),0,ScreenScale(100),ScreenScale(15),Color(20,20,20,200)) --Background Box
draw.RoundedBox(0,SX-ScreenScale(98),ScreenScale(2),ScreenScale(96),ScreenScale(11),Color(0,0,0,255)) --Thirst Bar Background
draw.RoundedBox(0,SX-ScreenScale(98),ScreenScale(2),ThirstBar,ScreenScale(11),ThirstColor) --Thirst Bar
draw.SimpleText("THIRST","OVERFHUDF",SX-ScreenScale(100/2),ScreenScale(15/2),Color(255,255,255),1,1) --Text
if(LocalPlayer():Alive()==false) then
draw.RoundedBox(0,0,0,4000,4000,Color(0,0,0,255))
draw.SimpleText("YOU ARE DEAD :(","OVERFHUDF2",SX/2,(SY/2)-ScreenScale(30),Color(255,255,255),1,1)
draw.SimpleText("CLICK TO RESPAWN","OVERFHUDF3",SX/2,(SY/2),Color(255,255,255),1,1)
end
end[/CODE]
Make sure you are AddCSLuaFile()'ing it. Also, in the future, post this in the Garry's Mod Developer Disscussion section; this section is for non-GLua programming.
[QUOTE=code_gs;45616418]Make sure you are AddCSLuaFile()'ing it. Also, in the future, post this in the Garry's Mod Developer Disscussion section; this section is for non-GLua programming.[/QUOTE]
i hAve a server file now and i added that to it, still not working :\
Sorry, you need to Log In to post a reply to this thread.