For a few days now, I have noticed that my crosshair is missing. It's only missing on the HL2 weapons and GMod weapons, an all other ones (CS:S, TF2, etc.) it still works. I'm wondering if I removed it by accidentally pressing a button, but if I did, I can't find a way to put it back on. Any help?
This can be caused by a simple problem but I'm not sure though, but check if this is it:
Go to C:/Program Files/Steam/steamapps/USERNAME/garrysmod/garrysmod/cfg and open "config.cfg" using Notepad and find "crosshair", make sure it is set to 1, aswell as the one under that line "cl_observercrosshair" is set to 1 too.
Hopes this helps. Feel free to contact me if you have any further issues.
Best Regards.
Sven.
[QUOTE=Svenskunganka;34539874]This can be caused by a simple problem but I'm not sure though, but check if this is it:
Go to C:/Program Files/Steam/steamapps/USERNAME/garrysmod/garrysmod/cfg and open "config.cfg" using Notepad and find "crosshair", make sure it is set to 1, aswell as the one under that line "cl_observercrosshair" is set to 1 too.
Hopes this helps. Feel free to contact me if you have any further issues.
Best Regards.
Sven.[/QUOTE]
I checked the file, both "crosshair" and "cl_observercrosshair" were set to one.
I still have this problem. Any more help?
Anything else?
Which addons do you have installed on Garry's Mod?
This can be caused by an addon aswell as an error in a lua file regarding crosshairs.
Have you tried to install any custom crosshairs?
No, I haven't installed any crosshairs, but I do have a lot of addons. I'm gonna look through the lua files and see if I can find any thing that's interfereing with the crosshair. Anything I should look for?
[QUOTE=racerfan;34558373]No, I haven't installed any crosshairs, but I do have a lot of addons. I'm gonna look through the lua files and see if I can find any thing that's interfereing with the crosshair. Anything I should look for?[/QUOTE]
rename your garrysmod folder
The HUDShouldDraw hook allows addons to hide some parts of the HUD you may find that an addon is hiding the crosshair via that.
I would move the addons out of your addons folder and go through the each one by one and adding them back to the addons directory and restarting your game.
Though if you do that I suggest going to offline mode on steam because some friends may not like their screen being filled with "playername is now playing Garry's Mod"
I don't see anything called "HUDShouldDraw" but I did find one called client_hud.lua. Could that be the problem? Also, for remaning the Gmod folder, which one? The 1st, or 2nd?
[editline]5th February 2012[/editline]
COntinuing on that, there's also a folder titled "HUD".
[editline]5th February 2012[/editline]
I'm also thinking that maybe, the original crosshair file was overwritten or deleted. Can someone privde me with the file that has the crosshair to see if that fixes it?
I believe crosshairs is hardcoded into garrysmod but can still be overwritten/overrided. I don't have any custom addons except Wiremod, Easy Precision, Adv Dupe, Stacker STool and SmartSnap. I don't have any lua file regarding crosshairs in either of those addon folders.
Can you paste the code using the CODE tags fro client_hud.lua and can you tell me what the name of that addons is which uses that lua file?
I honestly can't tell. I'm a noob to Gmod :U I'm gonna post the client_hud.lua file here. Can you try to tell if anything's out of the ordinary?
Here:
function TF_CustomHUDPaint()
if(!LocalPlayer() or !LocalPlayer():IsValid()) then
return
end
local scale_w = LocalPlayer():GetPanelScale()[1]
local scale_h = LocalPlayer():GetPanelScale()[2]
local team = LocalPlayer():Team()
if team == 1 then
team = "blue"
else
team = "red"
end
local tr = util.TraceLine(util.GetPlayerTrace(LocalPlayer()))
if(tr.HitNonWorld) then
local objs = { "obj_sentrygun", "obj_teleporter_entrance", "obj_teleporter_exit", "obj_dispenser" }
if(ValidEntity(tr.Entity) and table.HasValue( objs, tr.Entity:GetClass() ) and !LocalPlayer():InVehicle() and tr.Entity:GetNetworkedEntity( "owner" ) and ValidEntity(tr.Entity:GetNetworkedEntity( "owner" ))) then
local targetname
if tr.Entity:GetClass() == "obj_sentrygun" then
targetname = "Sentry"
elseif tr.Entity:GetClass() == "obj_teleporter_entrance" then
targetname = "Teleporter Entrance"
elseif tr.Entity:GetClass() == "obj_teleporter_exit" then
targetname = "Teleporter Exit"
else
targetname = "Dispenser"
end
local Message = targetname .. " built by " .. tr.Entity:GetNetworkedEntity( "owner" ):GetName()
surface.SetFont("Default")
local Width, Height = surface.GetTextSize(Message)
Height = Height *2
local width_lesser = 0
local class = tr.Entity:GetClass()
Width = Width + 25
if class == "obj_dispenser" then
width_lesser = 25
elseif class == "obj_teleporter_exit" then
width_lesser = 63
elseif class == "obj_teleporter_entrance" then
width_lesser = 96
end
local tex=surface.GetTextureID("HUD/objectives_timepanel_" .. team .. "_bg")
surface.SetTexture(tex)
surface.SetDrawColor(255,255,255,255)
local ply_name = tr.Entity:GetNetworkedEntity( "owner" ):GetName()
local building
if class == "obj_sentrygun" then
building = "Sentry Gun"
elseif class == "obj_dispenser" then
building = "Dispenser"
elseif class == "obj_teleporter_entrance" then
building = "Teleporter Entrance"
elseif class == "obj_teleporter_exit" then
building = "Teleporter Exit"
end
surface.SetFont( "TF2_font2" )
local str_w, str_h = surface.GetTextSize( building )
str_w = str_w /2
str_w = str_w +surface.GetTextSize( ply_name ) /2
local width = 680
if surface.GetTextSize( building .. " built by " .. ply_name ) > 480 then
width = width +(surface.GetTextSize( building .. " built by " .. ply_name ) -480)
end
surface.DrawTexturedRect(ScrW() *0.5 -(width /scale_w) /2, ScrH() *0.51, width /scale_w, 110 /scale_h )
draw.SimpleText(building .. " built by " .. ply_name, "TF2_font2", ScrW() *0.63 -(width /scale_w) /2 +str_w, ScrH() *0.54, Color(255, 255, 255, 255), 1, 1)
if class == "obj_sentrygun" and tr.Entity:GetNetworkedInt("sentrygun_level") != 3 then
draw.SimpleText("Upgrade Progress: " .. 200 -tr.Entity:GetNetworkedInt( "upgrade" ) .. " / 200", "TF2_font1", ScrW() *0.7 -(width /scale_w) /2, ScrH() *0.568, Color(255, 255, 255, 255), 1, 1)
end
local tex=surface.GetTextureID("HUD/health_equip_bg")
surface.SetTexture(tex)
surface.DrawTexturedRect(ScrW() *0.53 -(width /scale_w) /2, ScrH() *0.525, 76 /scale_w, 76 /scale_h )
//BUILDING HEALTH DISPLAY
local health = tr.Entity:GetNetworkedInt("health")
local health_max = 150
local sentry_level = tr.Entity:GetNetworkedInt("sentrygun_level")
if class == "obj_sentrygun" and sentry_level != 1 then
if sentry_level == 2 then
health_max = 180
else
health_max = 216
end
end
local scale_bottom
if health <= health_max /3 then
scale_bottom = (health /(health_max /3)) *18
else
scale_bottom = 18
end
local scale_top
if health > (health_max /3) *2 and health <= health_max then
scale_top = ((health -(health_max /3) *2) /(health_max /3)) *18
elseif health > health_max then
scale_top = 18
else
scale_top = nil
end
local scale_middle
if health >= health_max /3 and health <= (health_max /3) *2 then
scale_middle = ((health -(health_max /3)) /(health_max /3)) *60
elseif health > (health_max /3) *2 then
scale_middle = 60
else
scale_middle = nil
end
surface.SetTexture(surface.GetTextureID("HUD/health_bg"))
surface.SetDrawColor(255,255,255,255)
surface.DrawTexturedRect(ScrW() *0.539 -(width /scale_w) /2, ScrH() *0.532, 60 /scale_w, 60 /scale_h )
//surface.DrawTexturedRect((ScrW() -width) *0.325, ScrH() *0.532, 60 /scale_w, 60 /scale_h )
local health_bg_middle = "HUD/health_color_middle"
local health_bg_bottom = "HUD/health_color_bottom"
if health <= 1.5 *49 then
health_bg_middle = health_bg_middle .. "_red"
health_bg_bottom = health_bg_bottom .. "_red"
end
if scale_middle then
surface.SetTexture(surface.GetTextureID(health_bg_middle))
local w,h = surface.GetTextureSize( surface.GetTextureID("HUD/health_color_middle") )
surface.DrawTexturedRect(ScrW() *0.541 -(width /scale_w) /2, ScrH() *0.564 -(h *((scale_middle /scale_h) /100)) /2, 54 /scale_w, scale_middle /scale_h )
end
if scale_top then
surface.SetTexture(surface.GetTextureID("HUD/health_color_top"))
surface.DrawTexturedRect(ScrW() *0.552 -(width /scale_w) /2, ScrH() *0.512 +((45 /scale_h) -(scale_top /scale_h)), 18 /scale_w, scale_top /scale_h )
end
surface.SetTexture(surface.GetTextureID(health_bg_bottom))
surface.DrawTexturedRect(ScrW() *0.552 -(width /scale_w) /2, ScrH() *0.542 +((45 /scale_h) -(scale_bottom /scale_h)), 18 /scale_w, scale_bottom /scale_h )
//HEALTH DISPLAY END
//draw.RoundedBox(4, ScrW() - (Width + 1150), (ScrH()/2 - 100) - (8), Width + 8, Height + 8, Color(0, 0, 0, 150))
//draw.SimpleText(Message, "Default", ScrW() - (Width + 1075 -width_lesser) - 7, ScrH()/2 - 100, Color(255, 255, 255, 255), 1, 1)
//draw.SimpleText("Health: " .. tr.Entity:GetNetworkedInt( "health" ), "Default", ScrW() - (Width + 1085) - 7, ScrH()/2 - 85, Color(255, 255, 255, 255), 1, 1)
if tr.Entity:GetClass() == "obj_teleporter_entrance" then
if !tr.Entity:GetNetworkedBool("building") and !tr.Entity:GetNetworkedBool( "gotexit" ) then
draw.SimpleText("No matching exit!", "TF2_font1", ScrW() *0.656 -(width /scale_w) /2, ScrH() *0.568, Color(255, 255, 255, 255), 1, 1)
end
local recharge = tr.Entity:GetNetworkedInt( "recharge" )
if recharge < 100 and recharge > 0 then
surface.SetFont( "TF2_font1" )
local w, h = surface.GetTextSize(recharge)
draw.SimpleText("Recharging: " .. recharge .. "%", "TF2_font1", ScrW() *0.638 +w /2 -(width /scale_w) /2, ScrH() *0.568, Color(255, 255, 255, 255), 1, 1)
end
elseif tr.Entity:GetClass() == "obj_teleporter_exit" and !tr.Entity:GetNetworkedBool( "gotentrance" ) and !tr.Entity:GetNetworkedBool("building") then
draw.SimpleText("No matching entrance!", "TF2_font1", ScrW() *0.45, ScrH() *0.568, Color(255, 255, 255, 255), 1, 1)
end
elseif(ValidEntity(tr.Entity) and tr.Entity:GetNetworkedBool( 10 ) and !LocalPlayer():InVehicle()) then
local message = "Possessed by " .. tr.Entity:GetNetworkedEntity( 11 ):GetName()
surface.SetFont("Default")
local Width, Height = surface.GetTextSize(message)
Height = Height *2
Width = Width + 25
local color = Color(255,255,255,255)
draw.SimpleText(message, "Default", ScrW( ) /2, ScrH( ) /2, color, 1, 1)
end
end
surface.SetDrawColor(255,255,255,255)
local sentry = LocalPlayer():GetNetworkedEntity("sentrygun")
local dispenser = LocalPlayer():GetNetworkedEntity("dispenser")
local tp_entrance = LocalPlayer():GetNetworkedEntity("tp_entrance")
local tp_exit = LocalPlayer():GetNetworkedEntity("tp_exit")
//if sentry_sapped or dispenser_sapped or tp_entrance_sapped or tp_exit_sapped or (sentry_health and sentry_health <= 75) or (dispenser_health and dispenser_health <= 75) or (tp_entrance_health and tp_entrance_health <= 75) or (tp_exit_health and tp_exit_health <= 75) then
local function SetAlertColor()
local color = LocalP
There's noting in that code regarding crosshairs. There must be something else. And btw, next time, please use the CODE tags ;)
Disabling the default crosshair is a serverside script.
Sorry, you need to Log In to post a reply to this thread.