Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Viewmodel not working #5

Open
Robbob72 opened this issue Jan 5, 2018 · 5 comments · Fixed by Arizard/deathrun#172
Open

Viewmodel not working #5

Robbob72 opened this issue Jan 5, 2018 · 5 comments · Fixed by Arizard/deathrun#172
Labels

Comments

@Robbob72
Copy link

Robbob72 commented Jan 5, 2018

I put the download into the servers addons folder and the knives all appear there fine and the world model works
image
but anytime I equip the knives on my server the skin is the default texture
image
as far as I know the code should be exactly how it is on the github but just in case here is both the code for the weapon as well as the code for the pointshot.

Pointshop:

ITEM.Name = 'Butterfly Knife' .. ' | ' .. 'Boreal Forest'
ITEM.Price = 20000
ITEM.Model = 'models/weapons/w_csgo_butterfly.mdl'
ITEM.Skin = 1
ITEM.WeaponClass = 'csgo_butterfly_boreal'

function ITEM:OnEquip(ply)
ply:Give(self.WeaponClass)
end

function ITEM:OnBuy(ply)
ply:Give(self.WeaponClass)
ply:SelectWeapon(self.WeaponClass)
end

function ITEM:OnSell(ply)
ply:StripWeapon(self.WeaponClass)
end

function ITEM:OnHolster(ply)
ply:StripWeapon(self.WeaponClass)
end

Weapon:

if not file.Exists( 'weapons/csgo_baseknife.lua', 'LUA' ) then
SWEP.Spawnable = false
print( 'csgo_butterfly_boreal failed to initialize: csgo_baseknife.lua not found. Did you install the main part?' )
return
end

local TTT = ( GAMEMODE_NAME == "terrortown" or cvars.Bool("csgo_knives_force_ttt", false) )

DEFINE_BASECLASS( 'csgo_baseknife' )

if ( SERVER ) then
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false

if TTT then
SWEP.EquipMenuData = nil
end
end

if ( CLIENT ) then
SWEP.Slot = TTT and 6 or 2
SWEP.SlotPos = 0
end

SWEP.PrintName = 'Butterfly Knife' .. ' | ' .. 'Boreal Forest'
SWEP.Category = 'CS:GO Knives'

SWEP.Spawnable = true
SWEP.AdminSpawnable = true

SWEP.ViewModel = 'models/weapons/v_csgo_butterfly.mdl'
SWEP.WorldModel = 'models/weapons/w_csgo_butterfly.mdl'

SWEP.SkinIndex = 1
SWEP.PaintMaterial = nil
SWEP.AreDaggers = false

util.PrecacheModel( SWEP.ViewModel )
util.PrecacheModel( SWEP.WorldModel )

-- 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_EQUIP

-- 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 = "item_ammo_smg1_ttt"

-- 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 = nil

-- 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 = false

-- 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 = true

-- This sets the icon shown for the weapon in the DNA sampler, search window,
-- equipment menu (if buyable), etc.
SWEP.Icon = "vgui/entities/csgo_butterfly_boreal.vmt"

Ive checked the FAQ numerous times as well as check all other bug reports on the steam page and github and still have been unable to find the fix

@xDShot
Copy link
Owner

xDShot commented Jan 5, 2018

If you installed separate skin packs, try disabling them.

@Robbob72
Copy link
Author

Robbob72 commented Jan 6, 2018

I did not install any other skins packs.

@xDShot xDShot added the bug label Jan 6, 2018
@ceifa
Copy link

ceifa commented Jan 20, 2019

This problem is not an addon bug, but a gamemode bug. Probably the gamemode is overwriting "GM: PreDrawViewModel" and is not calling it from the weapon.

If you are using "Deathrun Neue", it is easy to fix, just replace the method for this:

function GM:PreDrawViewModel( vm, ply, wep )
    if LocalPlayer():GetObserverMode() == OBS_MODE_CHASE or LocalPlayer():GetObserverMode() == OBS_MODE_ROAMING then
        return true
    elseif wep and wep.PreDrawViewModel then
        return wep:PreDrawViewModel( vm, wep, ply )
    end
end

@ceifa
Copy link

ceifa commented May 7, 2020

where i replace?? i'm using arizard's deathrun, and the skins work for me, i see the skins... But in the pointshop, the skins appears without skins, any help?

I think your problem its unrelated to this issue, can you create new one?

@CurryBoi29
Copy link

What gamemode should i use, instead of Arizards to get my knives working?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants