• How do i use iron sight/Holding postions wont work.
    6 replies, posted
hi ive been trying to get iron sight to work and it hasent been working it just gives a meesage in the conssle saying swep command also whenever im in thirdperson testing the holding of the swep its always in pistol no matter what can someone help code--- [lua] resource.AddFile( "sound/weapons/fire_DC_15.wav" ) //General Settings \\ SWEP.AdminSpawnable = true // Is the swep spawnable for admin SWEP.ViewModelFOV = 64 // How much of the weapon do u see ? SWEP.ViewModel = "models/weapons/v_dc-15.mdl" // The viewModel, the model you se when you are holding it-.- SWEP.WorldModel = "models/weapons/w_dc-15.mdl" // The worlmodel, The model yu when it's down on the ground SWEP.AutoSwitchTo = false // when someone walks over the swep, chould i automatectly change to your swep ? SWEP.Slot = 2 // Deside wich slot you want your swep do be in 1 2 3 4 5 6 SWEP.HoldType = "smg" // How the swep is hold Pistol smg greanade melee SWEP.PrintName = "DC-15A" // your sweps name SWEP.Author = "Jangofett890" // Your name SWEP.Spawnable = true // Can everybody spawn this swep ? - If you want only admin keep this false and adminsapwnable true. SWEP.AutoSwitchFrom = false // Does the weapon get changed by other sweps if you pick them up ? SWEP.FiresUnderwater = false // 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.Category = "Star Wars" // Make your own catogory for the swep SWEP.SlotPos = 0 // Deside wich slot you want your swep do be in 1 2 3 4 5 6 SWEP.DrawAmmo = true // Does the ammo show up when you are using it ? True / False SWEP.ReloadSound = "Weapon_ar2.Reload" // Reload sound, you can use the default ones, or you can use your one; Example; "sound/myswepreload.waw" SWEP.Instructions = "left click shoot right Zoom" // How do pepole use your swep ? SWEP.Contact = "Jangofett890@gmail.com" // How Pepole chould contact you if they find bugs, errors, etc SWEP.Purpose = "Just have fun With this star wars weapon" // What is the purpose with this swep ? SWEP.base = "weapon_base" //General settings\\ //PrimaryFire Settings\\ SWEP.Primary.Sound = Sound("weapons/fire_DC_15.wav") // The sound that plays when you shoot :] SWEP.Primary.Damage = 15 // How much damage the swep is doing SWEP.Primary.TakeAmmo = 1 // How much ammo does it take for each shot ? SWEP.Primary.ClipSize = 50 // The clipsize SWEP.Primary.Ammo = "ar2" // ammmo type pistol/ smg1 SWEP.Primary.DefaultClip = 300 // How much ammo does the swep come with `? SWEP.Primary.Spread = 0.1 // 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 = 1 // How much we should punch the view SWEP.Primary.Delay = 0.2 // How long time before you can fire again SWEP.Primary.Force = 60 // The force of the shot //PrimaryFire settings\\ //Secondary Fire Variables\\ SWEP.Secondary.ClipSize = 0 // SWEP.Secondary.DefaultClip = 0 // SWEP.Secondary.Ammo = "none" // //Secondary Fire Variables\\ //SWEP:Initialize()\\ function SWEP:Initialize() util.PrecacheSound(self.Primary.Sound) util.PrecacheSound(self.Secondary.Sound) if ( SERVER ) then self:SetWeaponHoldType( self.HoldType ) end end //SWEP:Initialize()\\ //SWEP:PrimaryFire()\\ function SWEP:PrimaryAttack() if ( !self:CanPrimaryAttack() ) then return end 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 = 1 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.Weapon:EmitSound(Sound(self.Primary.Sound)) self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) ) self:TakePrimaryAmmo(self.Primary.TakeAmmo) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) end //SWEP:PrimaryFire()\\ //SWEP:SecondaryFire()\\ function SWEP:SecondaryAttack() SWEP.IronSightsPos = Vector (-6.048, -5.5809, 2.1322) SWEP.IronSightsAng = Vector (0, 0, 0) SWEP.IronSightZoom = 1.3 -- How much the player's FOV should zoom in ironsight mode. SWEP.UseScope = false -- Use a scope instead of iron sights. SWEP.DrawParabolicSights = false -- Set to true to draw a cool parabolic sight (helps with aiming over long distances) end //SWEP:SecondaryFire()\\ //---------- NPC Weapon list.Set( "NPCWeapons", "weapon_DC-15A", "DC-15A" ); [/lua]
You can't use "SWEP" inside of an SWEP function, you'd have to use "self" even then, you're supposed to define those things up top (Along with ammo and such), not in SecondaryAttack. Plus, you're overriding the default SecondaryAttack function when you define a new one (the base version). Delete the entire SecondaryAttack function and try again.
so like this [lua] resource.AddFile( "sound/weapons/fire_DC_15.wav" ) //General Settings \\ SWEP.AdminSpawnable = true // Is the swep spawnable for admin SWEP.ViewModelFOV = 64 // How much of the weapon do u see ? SWEP.ViewModel = "models/weapons/v_dc-15.mdl" // The viewModel, the model you se when you are holding it-.- SWEP.WorldModel = "models/weapons/w_dc-15.mdl" // The worlmodel, The model yu when it's down on the ground SWEP.AutoSwitchTo = false // when someone walks over the swep, chould i automatectly change to your swep ? SWEP.Slot = 2 // Deside wich slot you want your swep do be in 1 2 3 4 5 6 SWEP.HoldType = "smg" // How the swep is hold Pistol smg greanade melee SWEP.PrintName = "DC-15A" // your sweps name SWEP.Author = "Jangofett890" // Your name SWEP.Spawnable = true // Can everybody spawn this swep ? - If you want only admin keep this false and adminsapwnable true. SWEP.AutoSwitchFrom = false // Does the weapon get changed by other sweps if you pick them up ? SWEP.FiresUnderwater = false // 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.Category = "Star Wars" // Make your own catogory for the swep SWEP.SlotPos = 0 // Deside wich slot you want your swep do be in 1 2 3 4 5 6 SWEP.DrawAmmo = true // Does the ammo show up when you are using it ? True / False SWEP.ReloadSound = "Weapon_ar2.Reload" // Reload sound, you can use the default ones, or you can use your one; Example; "sound/myswepreload.waw" SWEP.Instructions = "left click shoot right Zoom" // How do pepole use your swep ? SWEP.Contact = "Jangofett890@gmail.com" // How Pepole chould contact you if they find bugs, errors, etc SWEP.Purpose = "Just have fun With this star wars weapon" // What is the purpose with this swep ? SWEP.base = "weapon_base" SWEP.IronSightsPos = Vector (-5.7945, -23.7008, 2.0281) SWEP.IronSightsAng = Vector (-0.8343, 1.7927, 0) //General settings\\ //PrimaryFire Settings\\ SWEP.Primary.Sound = Sound("weapons/fire_DC_15.wav") // The sound that plays when you shoot :] SWEP.Primary.Damage = 15 // How much damage the swep is doing SWEP.Primary.TakeAmmo = 1 // How much ammo does it take for each shot ? SWEP.Primary.ClipSize = 50 // The clipsize SWEP.Primary.Ammo = "ar2" // ammmo type pistol/ smg1 SWEP.Primary.DefaultClip = 300 // How much ammo does the swep come with `? SWEP.Primary.Spread = 0.1 // 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 = 1 // How much we should punch the view SWEP.Primary.Delay = 0.2 // How long time before you can fire again SWEP.Primary.Force = 60 // The force of the shot //PrimaryFire settings\\ //Secondary Fire Variables\\ SWEP.Secondary.ClipSize = 0 // SWEP.Secondary.DefaultClip = 0 // SWEP.Secondary.Ammo = "none" // //Secondary Fire Variables\\ //SWEP:Initialize()\\ function SWEP:Initialize() util.PrecacheSound(self.Primary.Sound) util.PrecacheSound(self.Secondary.Sound) if ( SERVER ) then self:SetWeaponHoldType( self.HoldType ) end end //SWEP:Initialize()\\ //SWEP:PrimaryFire()\\ function SWEP:PrimaryAttack() if ( !self:CanPrimaryAttack() ) then return end 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 = 1 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.Weapon:EmitSound(Sound(self.Primary.Sound)) self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) ) self:TakePrimaryAmmo(self.Primary.TakeAmmo) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) end //SWEP:PrimaryFire()\\ //SWEP:SecondaryFire()\\ function SWEP:SecondaryAttack() self:IronSightsPos () self:IronSightsAng () end //SWEP:SecondaryFire()\\ //---------- NPC Weapon list.Set( "NPCWeapons", "weapon_DC-15A", "DC-15A" ); [/lua] [editline]23rd May 2011[/editline] ???
help me please im realy close to finishing this [editline]23rd May 2011[/editline] ugghhh it dosent work what do i put here //SWEP:SecondaryFire()\\ function SWEP:SecondaryAttack() self:IronSightsPos () self:IronSightsAng () end //SWEP:SecondaryFire()\\
HELP!
I don't understand what else you need? If your base supports ironsights just delete the SecondaryAttack function completely, if not, you'll need to make it yourself. Post further errors.
how do i know if my base suports iron sight??
Sorry, you need to Log In to post a reply to this thread.