• Custom SWep viewmodel?
    3 replies, posted
Okay, I'm new to scripting and I thought I've give making a weapon a bash. Now, it's basic, but it has custom sounds and everything. But I'm attempting to use a custom viewmodel, but instead the 'ERROR' model appears. Here's the code. [code] SWEP.PrintName = "CMG-1" SWEP.Slot = 4 SWEP.SlotPos = 42 SWEP.DrawAmmo = true SWEP.DrawCrosshair = true SWEP.Author = "ChickenMan99" // Your name SWEP.Instructions = "Dakka dakka dakka!" // How do pepole use your swep ? SWEP.Contact = "Your asscrack" // How Pepole chould contact you if they find bugs, errors, etc SWEP.Purpose = "Run 'n' shoot, shoot 'n' run!" // What is the purpose with this swep ? SWEP.AdminSpawnable = false // Is the swep spawnable for admin SWEP.Spawnable = true // Can everybody spawn this swep ? - If you want only admin keep this false and adminsapwnable true. SWEP.ViewModelFOV = 64 // How much of the weapon do u see ? SWEP.ViewModel = ("weapons/v_smg_tin.mdl") // The viewModel, the model you se when you are holding it-.- SWEP.WorldModel = "models/weapons/w_smg1.mdl" // The worlmodel, The model yu when it's down on the ground SWEP.AnimPrefix = "smg" SWEP.ViewModelFlip = true SWEP.AutoSwitchTo = true // when someone walks over the swep, chould i automatectly change to your swep ? SWEP.AutoSwitchFrom = true // Does the weapon get changed by other sweps if you pick them up ? SWEP.Slot = 2 // Deside wich slot you want your swep do be in 1 2 3 4 5 6 SWEP.SlotPos = 42 // Deside wich slot you want your swep do be in 1 2 3 4 5 6 SWEP.HoldType = "smg1" // How the swep is hold Pistol smg greanade melee SWEP.FiresUnderwater = true // Does your swep fire under water ? SWEP.Weight = 5 // Chose the weight of the Swep SWEP.DrawCrosshair = true // Do you want it to have a crosshair ? SWEP.DrawAmmo = true // Does the ammo show up when you are using it ? True / False SWEP.ReloadSound = Sound( "Weapon_SMG1.Single" ) SWEP.base = "weapon_base" //General settings\\ //PrimaryFire Settings\\ SWEP.Primary.Sound = Sound ("modulus/fire1.wav") // The sound that plays when you shoot :] SWEP.Primary.Damage = 4 // How much damage the swep is doing SWEP.Primary.TakeAmmo = 1 // How much ammo does it take for each shot ? SWEP.Primary.ClipSize = 55 // The clipsize SWEP.Primary.Ammo = "smg1" // ammmo type pistol/ smg1 SWEP.Primary.DefaultClip= 65 // How much ammo does the swep come with `? SWEP.Primary.Spread = 0.20 // Does the bullets spread all over, if you want it fire exactly where you are aiming leave it o.1 SWEP.Primary.NumberofShots = 1 // How many bullets you are firing each shot. SWEP.Primary.Automatic = true // Is the swep automatic ? SWEP.Primary.Recoil = 0.3 // How much we should punch the view SWEP.Primary.Delay = 0.05 // How long time before you can fire again SWEP.Primary.Force = 10 // The force of the shot //PrimaryFire settings\\ SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = true SWEP.Secondary.Ammo = "gravity" //SWEP:Initialize\\ function SWEP:Initialize() util.PrecacheSound(self.Primary.Sound) util.PrecacheSound(self.Secondary.Sound) self:SetWeaponHoldType( self.HoldType ) end //SWEP:Initialize\\ //SWEP:PrimaryFire\\ function SWEP:PrimaryAttack() if ( !self:CanPrimaryAttack() ) then return end local bullet = {} bullet.Num = self.Primary.NumberofShots bullet.Src = self.Owner:GetShootPos() bullet.Dir = self.Owner:GetAimVector() bullet.Spread = Vector( self.Primary.Spread * 0.1 , self.Primary.Spread * 0.1, 0) bullet.Tracer = 0 bullet.Force = self.Primary.Force bullet.Damage = self.Primary.Damage bullet.AmmoType = self.Primary.Ammo local rnda = self.Primary.Recoil * -1 local rndb = self.Primary.Recoil * math.random(-1, 1) self:ShootEffects() self.Owner:FireBullets( bullet ) self:EmitSound(Sound(self.Primary.Sound)) self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) ) self:TakePrimaryAmmo(self.Primary.TakeAmmo) self:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) end //SWEP:PrimaryFire\\ [/code] Mostly it's cobbled together from other sweps, and the GMod Wiki's tutorial, which is why some of it may appear odd. What am I doing wrong?
SWEP.ViewModel = "weapons/v_smg_tin.mdl" SWEP.WorldModel = "models/weapons/w_smg1.mdl" or you hexed the model wrong
("weapons/v_smg_tin.mdl") why the ()? Just "weapons/v_smg_tin.mdl" Edit: Bah, ninjad
[QUOTE=Siminov;23104957]SWEP.ViewModel = "weapons/v_smg_tin.mdl" SWEP.WorldModel = "models/weapons/w_smg1.mdl" or you hexed the model wrong[/QUOTE] -snip- Hexing didn't work. It's in addon format, does that make a difference?
Sorry, you need to Log In to post a reply to this thread.