Down below is the disgusting cross-hair for my gamemode where is the deafault GM:DrawCrosshair for the Base gamemode?
[CODE]function GM:DrawCrosshair()
local trace = LocalPlayer():GetEyeTraceNoCursor().HitPos or vector_origin;
deltaPos = LerpVector(0.5, deltaPos, trace);
local screen = deltaPos:ToScreen();
local x, y = screen.x, screen.y - 18;
local length = LocalPlayer():GetVelocity():Length2D();
local spacing = math.min(6 + (length / 24), 64);
local distance = 16;
local distance2 = distance / -0.525;
local weapon = LocalPlayer():GetActiveWeapon();
if (IsValid(weapon) and weapon.GetMiss and weapon:GetMiss() > 0) then
deltaMiss = math.Approach(deltaMiss, weapon:GetMiss() * 18, FrameTime() * 30);
spacing = math.min(spacing + deltaMiss, 64);
end;
surface.SetDrawColor(255, 255, 255, 100);
surface.DrawLine(x, (y + distance+4) - spacing, x, y - spacing - 2);
surface.DrawLine(x - spacing, (y + distance) + spacing, (x - spacing) - distance, (y - distance2) + spacing);
surface.DrawLine(x + spacing, (y + distance) + spacing, (x + spacing) + distance, (y - distance2) + spacing);
end;[/CODE]
There's no default GM:DrawCrosshair in Base gamemode, it is not a default hook that exists in GMod.
The default crosshair is drawn from the engine, not Lua.
So how would I get the default crosshair?
Get how?
If you mean get the material, then it's the font "halflife2.ttf" in /resources.
If you mean get if it's activate, then you can use GetConVarBool("crosshair")
What I want is to draw the default crosshair for gmod instead of the
[CODE]function GM:DrawCrosshair()
local trace = LocalPlayer():GetEyeTraceNoCursor().HitPos or vector_origin;
deltaPos = LerpVector(0.5, deltaPos, trace);
local screen = deltaPos:ToScreen();
local x, y = screen.x, screen.y - 18;
local length = LocalPlayer():GetVelocity():Length2D();
local spacing = math.min(6 + (length / 24), 64);
local distance = 16;
local distance2 = distance / -0.525;
local weapon = LocalPlayer():GetActiveWeapon();
if (IsValid(weapon) and weapon.GetMiss and weapon:GetMiss() > 0) then
deltaMiss = math.Approach(deltaMiss, weapon:GetMiss() * 18, FrameTime() * 30);
spacing = math.min(spacing + deltaMiss, 64);
end;
surface.SetDrawColor(255, 255, 255, 100);
surface.DrawLine(x, (y + distance+4) - spacing, x, y - spacing - 2);
surface.DrawLine(x - spacing, (y + distance) + spacing, (x - spacing) - distance, (y - distance2) + spacing);
surface.DrawLine(x + spacing, (y + distance) + spacing, (x + spacing) + distance, (y - distance2) + spacing);
end;[/CODE]
So what would the code swap be?
I think you might want to look at [url]http://wiki.garrysmod.com/page/GM/HUDShouldDraw[/url] if anything. But I really can't understand what you're trying to do.
Are you trying to make a mod for another mod?
I'm assuming you're using the script that can be found [URL="http://pastebin.com/9yzXfPAD"]here[/URL]
Check line 55:
[CODE]
if (LocalPlayer():Team() == TEAM_GUARD or LocalPlayer():Team() == TEAM_PRISONER) then
self:DrawCrosshair();
end;
[/CODE]
Check line 229:
[CODE]
function GM:HUDShouldDraw(element)
if (element == "CHudHealth" or element == "CHudBattery" or element == "CHudCrosshair") then
return false;
end;
return true;
end;
[/CODE]
This should be an extremely simple operation
What are you say circuit I should just remove the CHudCrosshair or just switch it out for...??
Sorry, you need to Log In to post a reply to this thread.