Hi there Guest,  
Sign in here: Login through Steam



  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 
Crosshair Customizer?

#12
(02-24-2017, 11:28 PM)anangrybeaver Wrote:  I'm gonna look into it again.

But the last time I checked the crosshair isn't a universal thing in the code that I can replace. It's defined for each weapon separately for the most part I think. I may find something different this time around though. n o  p r o m i s e s

Nope, here's the base code in weapon_tttbase(SWEPs can override it using the DrawHUD() function, so guns that draw a custom crosshair would be fine)

PHP Code:
  local sights_opacity CreateConVar("ttt_ironsights_crosshair_opacity""0.8"FCVAR_ARCHIVE)
 
  local crosshair_brightness CreateConVar("ttt_crosshair_brightness""1.0"FCVAR_ARCHIVE)
 
  local crosshair_size CreateConVar("ttt_crosshair_size""1.0"FCVAR_ARCHIVE)
 
  local disable_crosshair CreateConVar("ttt_disable_crosshair""0"FCVAR_ARCHIVE)

 
  function SWEP:DrawHUD()
 
     if self.HUDHelp then
         self
:DrawHelp()
 
     end

      local client 
LocalPlayer()
 
     if disable_crosshair:GetBool() or (not IsValid(client)) then return end

      local sights 
= (not self.NoSights) and self:GetIronsights()

 
     local x math.floor(ScrW() / 2.0)
 
     local y math.floor(ScrH() / 2.0)
 
     local scale math.max(0.2 10 self:GetPrimaryCone())

 
     local LastShootTime self:LastShootTime()
 
     scale scale * (math.Clamp( (CurTime() - LastShootTime) * 50.01.0 ))

 
     local alpha sights and sights_opacity:GetFloat() or 1
      local bright 
crosshair_brightness:GetFloat() or 1

      
-- somehow it seems this can be called before my player metatable
      
-- additions have loaded
      if client
.IsTraitor and client:IsTraitor() then
         surface
.SetDrawColor(255 bright,
 
                             50 bright,
 
                             50 bright,
 
                             255 alpha)
 
     else
         surface
.SetDrawColor(0,
 
                             255 bright,
 
                             0,
 
                             255 alpha)
 
     end

      local gap 
math.floor(20 scale * (sights and 0.8 or 1))
 
     local length math.floor(gap + (25 crosshair_size:GetFloat()) * scale)
 
     surface.DrawLinelengthygap)
 
     surface.DrawLinelengthygap)
 
     surface.DrawLinexlengthxgap )
 
     surface.DrawLinexlengthxgap )
 
  end 

Funny enough, I was actually gonna ask Brass if I could make my own crosshair customizer, but haven't bothered yet.
Find
Reply



Messages In This Thread
Crosshair Customizer? - Excel - 04-17-2015, 01:16 AM
RE: Crosshair Customizer? - Dreadark - 04-17-2015, 01:19 AM
RE: Crosshair Customizer? - RadioActiveCow - 04-17-2015, 06:46 AM
RE: Crosshair Customizer? - MatlaS - 04-18-2015, 09:39 PM
RE: Crosshair Customizer? - Dreadark - 04-18-2015, 10:06 PM
RE: Crosshair Customizer? - MatlaS - 04-19-2015, 12:46 AM
RE: Crosshair Customizer? - Rotshout - 04-19-2015, 12:04 AM
RE: Crosshair Customizer? - Mod Mark - 02-24-2017, 10:30 PM
RE: Crosshair Customizer? - anangrybeaver - 02-24-2017, 11:28 PM
RE: Crosshair Customizer? - tobiasxz - 02-25-2017, 12:03 AM
RE: Crosshair Customizer? - Brassx - 02-25-2017, 02:43 AM

Forum Jump:


Users browsing this thread:
4 Guest(s)