• C_Models Help
    7 replies, posted
Hi, I have no idea how to do anything to do with c_models, the weapon pack I am using uses them ([url]http://steamcommunity.com/sharedfiles/filedetails/?id=187933083[/url]) I am only using 1 weapon out of that pack, The AK-47. How would I change my c_models for the gun. I think this is what I need to use but I'm not sure where I should put it :/ [code] function PLAYER:GetHandsModel() return { model = "models/weapons/c_arms_cstrike.mdl", skin = 1, body = "0100000" } end[/code]
Are you talking about changing the gun model or hand model? If it's the gun model, just change the SWEP.Viewmodel. If it's the hands, put that code anywhere outside of a function, but under the SWEP.stuff code.
[QUOTE=code_gs;44631725]Are you talking about changing the gun model or hand model? If it's the gun model, just change the SWEP.Viewmodel. If it's the hands, put that code anywhere outside of a function, but under the SWEP.stuff code.[/QUOTE] It's for the hand model, I put it down the bottom of the gun swep and I all I got was this lua error: [code][ERROR] addons/cssak/lua/weapons/ptp_cs_ak47/shared.lua:184: attempt to index global 'PLAYER' (a nil value) 1. unknown - addons/cssak/lua/weapons/ptp_cs_ak47/shared.lua:184[/code]
You have to run it the function clientside.
[QUOTE=code_gs;44632509]You have to run it the function clientside.[/QUOTE] I put it in "if ( CLIENT ) then" and then I made a lua file in lua/autorun/client and both of them didn't work.
Post your code.
[code]if ( SERVER ) then AddCSLuaFile( "shared.lua" ) end if ( CLIENT ) then SWEP.PrintName = "AK-47" SWEP.Author = "Counter-Strike: ADV" SWEP.Slot = 2 SWEP.SlotPos = 1 SWEP.IconLetterCSS = "b" killicon.AddFont( "ptp_cs_ak47", "CSKillIcons", SWEP.IconLetterCSS, Color( 255, 80, 0, 255 ) ) end SWEP.HoldType = "ar2" SWEP.Base = "ptp_weapon_base" SWEP.Category = "Counter-Strike: PTP" SWEP.ViewModelFlip = false SWEP.ViewModelFOV = 60 SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.UseHands = true SWEP.ViewModel = "models/weapons/cstrike/c_rif_ak47.mdl" SWEP.WorldModel = "models/weapons/w_rif_ak47.mdl" SWEP.Weight = 5 SWEP.AutoSwitchTo = true SWEP.AutoSwitchFrom = true SWEP.Primary.Sound = Sound( "weapon_ak47.single" ) SWEP.Primary.Recoil = 3 SWEP.Primary.Damage = 34 SWEP.Primary.NumShots = 1 SWEP.Primary.Cone = 0.02 SWEP.Primary.ClipSize = 30 SWEP.Primary.Delay = 0.1 SWEP.Primary.DefaultClip = 90 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "smg1" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" SWEP.IronSightsPos = Vector(-6.57, -6.375, 2.354) SWEP.IronSightsAng = Vector(2.497, 0.05, 0.7) SWEP.AimSightsPos = Vector(-6.59, -5.00, 2.25) SWEP.AimSightsAng = Vector(2.20, 0.00, 0.00) SWEP.DashArmPos = Vector(4.355, -7.206, -0.681) SWEP.DashArmAng = Vector(-10.965, 37.062, -10.664) -- Accuracy SWEP.CrouchCone = 0.01 -- Accuracy when we're crouching SWEP.CrouchWalkCone = 0.02 -- Accuracy when we're crouching and walking SWEP.WalkCone = 0.025 -- Accuracy when we're walking SWEP.AirCone = 0.1 -- Accuracy when we're in air SWEP.StandCone = 0.015 -- Accuracy when we're standing still SWEP.Delay = 0.1 SWEP.Recoil = 3 SWEP.RecoilZoom = 0.7 SWEP.IronSightsCone = 0.01 /*--------------------------------------------------------- Draw a CrossHair! ---------------------------------------------------------*/ //Ripped from LeErOy NeWmAn, Don't tell him shhh SWEP.CrosshairScale = 1 function SWEP:DrawHUD() local Hl2CrossHair = true if GetConVar("sv_ptp_hl2crosshair_enable") == nil then Hl2CrossHair = true else Hl2CrossHair = GetConVar("sv_ptp_hl2crosshair_enable"):GetBool() end if not(Hl2CrossHair) then local DisableDashing = false if GetConVar("sv_ptp_dashing_disable") == nil then DisableDashing = false else DisableDashing = GetConVar("sv_ptp_dashing_disable"):GetBool() end if self.Owner:KeyDown(IN_SPEED) and not DisableDashing then return end //Remove CrossHair on Sprint local DrawCrossHair = false if GetConVar("sv_ptp_crosshair_disable") == nil then DrawCrossHair = false else DrawCrossHair = GetConVar("sv_ptp_crosshair_disable"):GetBool() end if DrawCrossHair then return end local x = ScrW() * 0.5 local y = ScrH() * 0.5 local scalebywidth = (ScrW() / 1024) * 10 local scale = 1 local canscale = true scale = scalebywidth * self.Primary.Cone surface.SetDrawColor(8, 255, 0, 255) local LastShootTime = self.Weapon:GetNetworkedFloat( "LastShootTime", 0 ) scale = scale * (2 - math.Clamp( (CurTime() - LastShootTime) * 5, 0.0, 1.0 )) local dist = math.abs(self.CrosshairScale - scale) self.CrosshairScale = math.Approach(self.CrosshairScale, scale, FrameTime() * 2 + dist * 0.05) local gap = 30 * self.CrosshairScale local length = gap + 15 * self.CrosshairScale 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) //surface.DrawLine(x-2, y, x+2, y) //surface.DrawLine(x, y-2, x, y+2) else if self.Weapon:GetNetworkedBool( "Ironsights" , true) and not self.Owner:KeyDown(IN_SPEED) then self.DrawCrosshair = true else self.DrawCrosshair = true end end end /*--------------------------------------------------------- DrawHud 2 ---------------------------------------------------------*/ function SWEP:DrawHud2() local Hl2CrossHair = true if GetConVar("sv_ptp_hl2crosshair_enable") == nil then Hl2CrossHair = true else Hl2CrossHair = GetConVar("sv_ptp_hl2crosshair_enable"):GetBool() end if not(Hl2CrossHair) then local DrawCSSCrossHair = false if GetConVar("sv_ptp_crosshair_disable") == nil then DrawCSSCrossHair = false else DrawCSSCrossHair = GetConVar("sv_ptp_crosshair_disable"):GetBool() end if self.Weapon:GetNetworkedBool( "Ironsights" , true) and DrawCSSCrossHair and not self.Owner:KeyDown(IN_SPEED) then self.DrawCrosshair = true else self.DrawCrosshair = false end end end[/code]
Bump
Sorry, you need to Log In to post a reply to this thread.