TTT coustom weapons and traitor vgui icons

Ok guys im sure im just being an idiot. I fixed this on an old server. what the heck is going on?

I have a file that should be forcing workshop downloads.

File Name: workshop.lua
File Location: garrysmod/lua/autorun/server
[lua]resource.AddWorkshop( “279464154” ) – TTT USP-40
resource.AddWorkshop( “253736514” ) – TTT Traitor AWP
resource.AddWorkshop( “194965598” ) – TTT Weapon Collection
resource.AddWorkshop( “286533896” ) – TFlippy’s TTT Weapon Pack
resource.AddWorkshop( “169089586” ) – ttt_waterworld Materials
resource.AddWorkshop( “567592398” ) – TTT Cannibalism
resource.AddWorkshop( “278468691” ) – ttt_mk17_(scar)
resource.AddWorkshop( “222589656” ) – ttt_scar_mk-17_222589656
resource.AddWorkshop( “373500128” ) – ttt_traitor_m4a16_373500128
resource.AddWorkshop( “305101059” ) – ttt_identification_bomb_+_defuser

resource.AddWorkshop( “254177306” ) --ttt_s.l.a.m_254177306
resource.AddWorkshop( “162581348” ) --ttt_-_defibrillator_162581348
resource.AddWorkshop( “278574247” ) --ttt_barrett_m82_278574247

resource.AddWorkshop( “165558674” ) --ttt_weapon_-_thompson_g2_contender_by_humility_165558674
resource.AddWorkshop( “456189236” ) --[ttt]_traitor_harpoon_456189236
resource.AddWorkshop( “590909626” ) --ttt_handcuffs_590909626[/lua]

And for example the traitor icon for the silent AWP does not work. here is the code for the silent AWP
File Name: weapon_ttt_awp.lua
[lua]if server then
AddCSLuaFile(“weapon_ttt_awp.lua”)
resource.AddFile(“models/weapons/cstrike/c_snip_awp.mdl”)
resource.AddFile(“models/weapons/w_snip_awp.mdl”)
resource.AddFile(“vgui/ttt/icon_awp.vmt”)
end

if CLIENT then
SWEP.PrintName = “Silenced AWP”
SWEP.Slot = 6
SWEP.Icon = “vgui/ttt/icon_awp”
SWEP.IconLetter = “r”
end

– Always derive from weapon_tttbase
SWEP.Base = “weapon_tttbase”

– Standard GMod values
SWEP.HoldType = “ar2”

SWEP.Primary.Ammo = “none”
SWEP.Primary.Delay = 2
SWEP.Primary.Recoil = 10
SWEP.Primary.Cone = 0.001
SWEP.Primary.Damage = 500
SWEP.Primary.Automatic = false
SWEP.Primary.ClipSize = 2
SWEP.Primary.ClipMax = 2
SWEP.Primary.DefaultClip = 2
SWEP.Primary.Sound = Sound( “Weapon_M4A1.Silenced” )
SWEP.Secondary.Sound = Sound( “Default.Zoom” )

– Model properties
SWEP.UseHands = true
SWEP.ViewModelFlip = false
SWEP.ViewModelFOV = 64
SWEP.ViewModel = Model( “models/weapons/cstrike/c_snip_awp.mdl” )
SWEP.WorldModel = Model( “models/weapons/w_snip_awp.mdl” )

SWEP.IronSightsPos = Vector( 5, -15, -2 )
SWEP.IronSightsAng = Vector( 2.6, 1.37, 3.5 )

– TTT config values

– Kind specifies the category this weapon is in. Players can only carry one of
– each. Can be: WEAPON_… MELEE, PISTOL, HEAVY, NADE, CARRY, EQUIP1, EQUIP2 or ROLE.
– Matching SWEP.Slot values: 0 1 2 3 4 6 7 8
SWEP.Kind = WEAPON_EQUIP1

– If AutoSpawnable is true and SWEP.Kind is not WEAPON_EQUIP1/2, then this gun can
– be spawned as a random weapon.
SWEP.AutoSpawnable = false

– The AmmoEnt is the ammo entity that can be picked up when carrying this gun.
SWEP.AmmoEnt = “none”

– CanBuy is a table of ROLE_* entries like ROLE_TRAITOR and ROLE_DETECTIVE. If
– a role is in this table, those players can buy this.
SWEP.CanBuy = { ROLE_TRAITOR }

– InLoadoutFor is a table of ROLE_* entries that specifies which roles should
– receive this weapon as soon as the round starts. In this case, none.
SWEP.InLoadoutFor = { nil }

– If LimitedStock is true, you can only buy one per round.
SWEP.LimitedStock = true

– If AllowDrop is false, players can’t manually drop the gun with Q
SWEP.AllowDrop = true

– If IsSilent is true, victims will not scream upon death.
SWEP.IsSilent = true

– If NoSights is true, the weapon won’t have ironsights
SWEP.NoSights = false

function SWEP:SetZoom( state )
if CLIENT then
return
elseif IsValid( self.Owner ) and self.Owner:IsPlayer() then
if state then
self.Owner:SetFOV( 20, 0.3 )
else
self.Owner:SetFOV( 0, 0.2 )
end
end
end

function SWEP:PrimaryAttack( worldsnd )
self.BaseClass.PrimaryAttack( self, worldsnd )
self:SetNextSecondaryFire( CurTime() + 0.1 )
end

– Add some zoom to ironsights for this gun
function SWEP:SecondaryAttack()
if not self.IronSightsPos then return end
if self:GetNextSecondaryFire() > CurTime() then return end

local bIronsights = not self:GetIronsights()

self:SetIronsights( bIronsights )

if SERVER then
self:SetZoom( bIronsights )
else
self:EmitSound( self.Secondary.Sound )
end

self:SetNextSecondaryFire( CurTime() + 0.3 )
end

function SWEP:PreDrop()
self:SetZoom( false )
self:SetIronsights( false )
return self.BaseClass.PreDrop( self )
end

function SWEP:Reload()
if ( self:Clip1() == self.Primary.ClipSize or self.Owner:GetAmmoCount( self.Primary.Ammo ) <= 0 ) then return end
self:DefaultReload( ACT_VM_RELOAD )
self:SetIronsights( false )
self:SetZoom( false )
end

function SWEP:Holster()
self:SetIronsights( false )
self:SetZoom( false )
return true
end

if CLIENT then
local scope = surface.GetTextureID( “sprites/scope” )
function SWEP:DrawHUD()
if self:GetIronsights() then
surface.SetDrawColor( 0, 0, 0, 255 )

     local scrW = ScrW()
     local scrH = ScrH()

     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 )

     -- Cover gaps on top and bottom of screen
     surface.DrawLine( 0, 0, scrW, 0 )
     surface.DrawLine( 0, scrH - 1, scrW, scrH - 1 )

     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

– Equipment menu information is only needed on the client
if CLIENT then
– Text shown in the equip menu
SWEP.EquipMenuData = {
type = “Weapon”,
desc = "Silenced AWP Sniper Rifle.

Only has two shots.

Victims will not scream when killed."
}
end
[/lua]
All i get is a purple missing texture icon.

any help would be great!
thank you
-Matt

Move to lua/autorun and use this instead.



if ( SERVER ) then
resource.AddWorkshop( '279464154' ) -- TTT USP-40
resource.AddWorkshop( '253736514' ) -- TTT Traitor AWP
resource.AddWorkshop( '194965598' ) -- TTT Weapon Collection
resource.AddWorkshop( '286533896' ) -- TFlippy's TTT Weapon Pack
resource.AddWorkshop( '169089586' ) -- ttt_waterworld Materials
resource.AddWorkshop( '567592398' ) -- TTT Cannibalism
resource.AddWorkshop( '278468691' ) -- ttt_mk17_(scar)
resource.AddWorkshop( '222589656' ) -- ttt_scar_mk-17_222589656
resource.AddWorkshop( '373500128' ) -- ttt_traitor_m4a16_373500128
resource.AddWorkshop( '305101059' ) -- ttt_identification_bomb_+_defuser'

resource.AddWorkshop( '254177306' ) --ttt_s.l.a.m_254177306
resource.AddWorkshop( '162581348' ) --ttt_-_defibrillator_162581348
resource.AddWorkshop( '278574247' ) --ttt_barrett_m82_278574247

resource.AddWorkshop( '165558674' ) --ttt_weapon_-_thompson_g2_contender_by_humility_165558674
resource.AddWorkshop( '456189236' ) --[ttt]_traitor_harpoon_456189236
resource.AddWorkshop( '590909626' ) --ttt_handcuffs_590909626
end


testing

[editline]6th February 2016[/editline]

that does not seem to have done the trick

lua/autorun/server = lua/autorun “with if SERVER then”

[editline]6th February 2016[/editline]

Are you 100% sure that the material for the icon is in the Workshop package and that the code is not using a different path or has a typo?

soooo i just realised that i somehow i do not have a garrysmod/materials or garrysmod/models

do you think that might have something to do with it?
haha oh man

http://i.imgur.com/auCmEHE.png

As long as its on your workshop package it should work…

and to answer your question yes the .vmt and .vtf are present for icon_awp

[editline]6th February 2016[/editline]

another problem for example is i cannot hear the sounds associated with the jihad.

weird… are you sure the WorkshopDL file is being ran and that the you’re downloading them when you join?
Because I used a workshop addon to fix missing textures (DarkRP) and it worked perfectly…

so you are correct it seems that the workshop is not downloading. And im not sure why or what im doing wrong? can you post and example of your forced dl for workshop and the file location please?

[editline]10th February 2016[/editline]

soooo… um i figured out what the problem was… and i kinda am mad at my self because it was a stupid mistake. in setting-> multiplayer i had downloads set to map only -_- im sorry for wasting your time. thanks for all the help though!!

  • Matt