I am using this script for an advertisement bar at the top of the client's screen. It appears to not be working. Anyone Help?
[lua]
local Text = {};
Text[1] = "This Gamemode is WIP by M4RK";
Text[2] = "We needs more Devs to make this the best it can be\nContact M4RK on steam"
Text[3] = "Donator Coming Soon!";
Text[4] = "Website Coming Soon"
local TimePer = 10;
local Fade = 60;
local Font = "TabLarge";
local TextColor = Color(255, 255, 255, 255);
local Background = Color(255, 255, 255, 150);
local Foreground = Color(0, 0, 0, 150);
local Start_Y = 0;
local FadeAlpha = 255 / 60;
local CurText = 1;
local LastDo = 1;
local CurFade = 60;
local CurStart = 0;
local Phase = false;
local CurX = 256
hook.Add("HUDPaint", "YourMom", function()
surface.SetFont(Font);
X, Y = CurX, 13
local Width = X + 20;
local Height = Y + 10;
local Start_X = (ScrW() * .5) - (Width * .5);
local LineY = Start_Y + (Height * .5) - 1;
surface.SetDrawColor(Background.r, Background.g, Background.b, Background.a);
surface.DrawOutlinedRect(Start_X - 1, Start_Y - 1, Width + 2, Height + 2);
surface.SetDrawColor(Foreground.r, Foreground.g, Foreground.b, Foreground.a);
surface.DrawRect(Start_X, Start_Y, Width, Height);
local PerformText = CurText;
local Alpha = 255;
if CurTime() > CurStart + TimePer then
CurText = CurText + 1;
if CurText > #Text then
CurText = 1;
end
CurStart = CurTime() + 5000;
end
local _x, _y = surface.GetTextSize(Text[CurText])
CurX = math.Approach(CurX, _x, 2)
if LastDo != CurText then
if !Phase then
CurFade = CurFade - 2;
PerformText = LastDo;
Alpha = CurFade * FadeAlpha
if CurFade == 0 then
Phase = true;
end
else
CurFade = CurFade + 2;
PerformText = CurText;
Alpha = CurFade * FadeAlpha
if CurFade == Fade then
Phase = false;
LastDo = CurText;
end
CurStart = CurTime();
end
end
draw.SimpleText(Text[PerformText], Font, ScrW() * .5, Start_Y + (Height * .5), Color(TextColor.r, TextColor.g, TextColor.b, Alpha), 1, 1);
surface.SetDrawColor(Background.r, Background.g, Background.b, Background.a);
surface.DrawLine(0, LineY, Start_X - 1, LineY);
surface.DrawLine(Start_X + Width + 1, LineY, ScrW(), LineY);
end)[/lua]
Do you have any syntax errors?
No, for some reason it just doesn't run.
Put a print statement inside the file to see if its actually running.
Yeah, it's running. Is the location wrong? It's in autorun.
If it's in autorun, you need to add if( CLIENT ) then at the top.
autorun/client is where it should be.
If it was in autorun it would run on both the server and the client but you didn't AddCSLuaFile it so its just going to run on the server.
Just add AddCSLuaFile("yourFile.lua") at the very top.
Then enclose everything with a if-statement with the param as SERVER.
[editline]
Typo- my bad.
[QUOTE=zzaacckk;32456587]If it was in autorun it would run on both the server and the client but you didn't AddCSLuaFile it so its just going to run on the server.
Just add AddCSLuaFile("yourFile.lua") at the very top.
Then enclose everything with a if-statement with the param as CLIENT.[/QUOTE]
AddCSLuaFile is serverside, so just add this to the top and leave it in autorun.
[lua]if SERVER then
AddCSLuaFile("yourFile.lua")
return
end
[/lua]
Sorry, you need to Log In to post a reply to this thread.