• Adding weapon selection icons.
    0 replies, posted
I am talking about the icons that you see when you scroll with your mouse wheel. I really want to use mad cow's icons ([url]http://www.garrysmod.org/downloads/?a=view&id=87297[/url]) I have a few of his weapons in my gamemode allready, and the icons are working fine for those weapons. But I also have some custom weapons that I made, and I would like to use his icons in my sweps. For example, here is my fist swep: [code] if ( SERVER ) then AddCSLuaFile( "shared.lua" ) end if ( CLIENT ) then SWEP.PrintName = "Fists" SWEP.Slot = 0 SWEP.SlotPos = 10 SWEP.ViewModelFOV = 70 SWEP.IconLetter = "x" [b]// Override this in your SWEP to set the icon in the weapon selection if (file.Exists("../materials/weapons/weapon_mad_fists.vmt")) then SWEP.WepSelectIcon = surface.GetTextureID("weapons/weapon_mad_fists")[/b] end -----------------------Main functions---------------------------- -- function SWEP:Reload() --To do when reloading -- end function SWEP:Think() -- Called every frame end function SWEP:Initialize() util.PrecacheSound("physics/flesh/flesh_impact_bullet" .. math.random( 3, 5 ) .. ".wav") util.PrecacheSound("weapons/iceaxe/iceaxe_swing1.wav") end function SWEP:PrimaryAttack() self.Weapon:SetNextPrimaryFire(CurTime() + .4) local trace = self.Owner:GetEyeTrace() if trace.HitPos:Distance(self.Owner:GetShootPos()) <= 75 then self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER) bullet = {} bullet.Num = 1 bullet.Src = self.Owner:GetShootPos() bullet.Dir = self.Owner:GetAimVector() bullet.Spread = Vector(0, 0, 0) bullet.Tracer = 0 bullet.Force = 5 bullet.Damage = 5 self.Owner:FireBullets(bullet) self.Owner:SetAnimation( PLAYER_ATTACK1 ); self.Weapon:EmitSound("physics/flesh/flesh_impact_bullet" .. math.random( 3, 5 ) .. ".wav") else self.Owner:SetAnimation(PLAYER_ATTACK1); self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER); end self.Weapon:SendWeaponAnim(ACT_VM_MISSCENTER) self.Weapon:SetNextPrimaryFire(CurTime() + .75) self.Owner:SetAnimation(PLAYER_ATTACK1); end function SWEP:SecondaryAttack() end function SWEP:Initialize() self:SetWeaponHoldType("fist") end ------------------------------------------------------------------- ------------General Swep Info--------------- SWEP.Author = "" SWEP.Contact = "" SWEP.Purpose = "" SWEP.Instructions = "" SWEP.Spawnable = true SWEP.AdminSpawnable = true [b]SWEP.Base = "weapon_mad_base"[/b] ----------------------------------------------- ------------Models--------------------------- SWEP.ViewModel = "models/weapons/v_fists.mdl" SWEP.WorldModel = "models/weapons/w_fists_t.mdl" ----------------------------------------------- -------------Primary Fire Attributes---------------------------------------- SWEP.Primary.Delay = 0.6 --In seconds SWEP.Primary.Recoil = 0 --Gun Kick SWEP.Primary.Damage = 5 --Damage per Bullet SWEP.Primary.NumShots = 1 --Number of shots per one fire SWEP.Primary.Cone = 0 --Bullet Spread SWEP.Primary.ClipSize = 1 --Use "-1 if there are no clips" SWEP.Primary.DefaultClip = 1 --Number of shots in next clip SWEP.Primary.Automatic = true --Pistol fire (false) or SMG fire (true) -------------End Primary Fire Attributes------------------------------------ -------------Secondary Fire Attributes------------------------------------- SWEP.Secondary.Delay = 0.9 SWEP.Secondary.Recoil = 0 SWEP.Secondary.Damage = 0 SWEP.Secondary.NumShots = 1 SWEP.Secondary.Cone = 0 SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = true SWEP.Secondary.Ammo = "none" -------------End Secondary Fire Attributes-------------------------------- [/code] The bolded stuff is what is important. And here is the part of the weapon_mad_base that deals with the icons: [code] // Override this in your SWEP to set the icon in the weapon selection if (file.Exists("../materials/weapons/swep.vmt")) then SWEP.WepSelectIcon = surface.GetTextureID("weapons/swep") end [/code] As you can see, I did override that code in my fists swep, yet, the icon still isn't working. Any suggestions? And, is there also a different function for adding in the inventory icons that might work?
Sorry, you need to Log In to post a reply to this thread.