• TTT Weapon Custom Zoom
    2 replies, posted
I want to add the .vtf's that came with the M9K packs as the custom zoom instead of the default sniper zoom. I have no idea how to start so can anyone lead me to solve this?
If you look at the code for the zoom, you should see a reference to either GetMaterial, or GetTextureID, etc.. Just change it from one zoom material/texture ( sometimes it has the extension in the case of GetMaterial, and sometimes it doesn't like with the Texture method ) to the m9k one. Make sure the clients are downloading the m9k packs from the workshop.
[QUOTE=Acecool;44047879]If you look at the code for the zoom, you should see a reference to either GetMaterial, or GetTextureID, etc.. Just change it from one zoom material/texture ( sometimes it has the extension in the case of GetMaterial, and sometimes it doesn't like with the Texture method ) to the m9k one. Make sure the clients are downloading the m9k packs from the workshop.[/QUOTE] Whenever I add the location of the zoom vtf's it just brings up a squared shot of a player that last killed me. How would it look like? [CODE]if CLIENT then local scope = surface.GetTextureID("materials/scope/gdcw_parabolicsight.vtf") function SWEP:DrawHUD() if self:GetIronsights() then surface.SetDrawColor( 0, 0, 0, 255 ) local x = ScrW() / 2.0 local y = ScrH() / 2.0 local scope_size = ScrH() -- crosshair local gap = 80 local length = scope_size surface.DrawLine( x - length, y, x - gap, y ) surface.DrawLine( x + length, y, x + gap, y ) surface.DrawLine( x, y - length, x, y - gap ) surface.DrawLine( x, y + length, x, y + gap ) gap = 0 length = 50 surface.DrawLine( x - length, y, x - gap, y ) surface.DrawLine( x + length, y, x + gap, y ) surface.DrawLine( x, y - length, x, y - gap ) surface.DrawLine( x, y + length, x, y + gap ) -- cover edges local sh = scope_size / 2 local w = (x - sh) + 2 surface.DrawRect(0, 0, w, scope_size) surface.DrawRect(x + sh - 2, 0, w, scope_size) surface.SetDrawColor(255, 0, 0, 255) surface.DrawLine(x, y, x + 1, y + 1) -- scope surface.SetTexture(scope) surface.SetDrawColor(255, 255, 255, 255) surface.DrawTexturedRectRotated(x, y, scope_size, scope_size, 0) else return self.BaseClass.DrawHUD(self) end end function SWEP:AdjustMouseSensitivity() return (self:GetIronsights() and 0.2) or nil end end [/CODE] [editline]25th February 2014[/editline] [QUOTE=Aeternal;44048032]Whenever I add the location of the zoom vtf's it just brings up a squared shot of a player that last killed me. How would it look like? [CODE]if CLIENT then local scope = surface.GetTextureID("materials/scope/gdcw_parabolicsight.vtf") function SWEP:DrawHUD() if self:GetIronsights() then surface.SetDrawColor( 0, 0, 0, 255 ) local x = ScrW() / 2.0 local y = ScrH() / 2.0 local scope_size = ScrH() -- crosshair local gap = 80 local length = scope_size surface.DrawLine( x - length, y, x - gap, y ) surface.DrawLine( x + length, y, x + gap, y ) surface.DrawLine( x, y - length, x, y - gap ) surface.DrawLine( x, y + length, x, y + gap ) gap = 0 length = 50 surface.DrawLine( x - length, y, x - gap, y ) surface.DrawLine( x + length, y, x + gap, y ) surface.DrawLine( x, y - length, x, y - gap ) surface.DrawLine( x, y + length, x, y + gap ) -- cover edges local sh = scope_size / 2 local w = (x - sh) + 2 surface.DrawRect(0, 0, w, scope_size) surface.DrawRect(x + sh - 2, 0, w, scope_size) surface.SetDrawColor(255, 0, 0, 255) surface.DrawLine(x, y, x + 1, y + 1) -- scope surface.SetTexture(scope) surface.SetDrawColor(255, 255, 255, 255) surface.DrawTexturedRectRotated(x, y, scope_size, scope_size, 0) else return self.BaseClass.DrawHUD(self) end end function SWEP:AdjustMouseSensitivity() return (self:GetIronsights() and 0.2) or nil end end [/CODE][/QUOTE] Heres an example: Zoom Out [IMG]http://i.imgur.com/iYilk7S.jpg[/IMG] Zoom In [IMG]http://i.imgur.com/3d98pNs.jpg[/IMG]
Sorry, you need to Log In to post a reply to this thread.