• hk416 swep help
    7 replies, posted
Hey guys im sorta new here as you can see but im also an amateur LUA coder. Im trying to program a model (HK416) i found on Garry's Mod which can be found here [url]http://www.garrysmod.org/downloads/?a=view&id=18418[/url] anyways i added all the code and i realized it didn't have a view model. Well i just copied the model files and renamed it to v_416_m416.mdl which in its case the world model would be w_416_m416.mdl so i did that and with all the code in place i launched gmod but when i equipped the weapon it was really high in the air but viewable and shot and their was also no sound and it shot like a shotgun. Here is the code -----> if ( CLIENT ) then SWEP.Category = "RED WEAPONS" SWEP.Author = "dnatoxic" SWEP.Contact = "No contacts" SWEP.Purpose = "Shoot! SHOOOT!" SWEP.Instructions = " ." SWEP.PrintName = "Jitte" SWEP.Instructions = "" SWEP.Slot = 2 SWEP.SlotPos = 0 SWEP.IconLetter = "r" killicon.AddFont("cse_awp","CSKillIcons",SWEP.Icon Letter,Color(255,80,0,255)) end if ( SERVER ) then AddCSLuaFile( "shared.lua" ) end SWEP.Base = "g36_base1" SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.ViewModel = "models/weapons/NT/v__416_m416.mdl" SWEP.WorldModel = "models/weapons/NT/w_416_m416.mdl" SWEP.HoldType = "ar2" SWEP.Weight = 6.8 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false SWEP.Primary.Sound = Sound("weapons/sound/mx_fire_2") SWEP.Primary.Recoil = 5 SWEP.Primary.Unrecoil = 3.5 SWEP.Primary.Damage = 9950 SWEP.Primary.NumShots = 4 SWEP.Primary.Cone = 0 SWEP.Primary.ClipSize = 21 SWEP.Primary.Delay = 0.06 //Don't use this, use the tables below! SWEP.Primary.DefaultClip = 81 //Always set this 1 higher than what you want. SWEP.Primary.Automatic = true //Don't use this, use the tables below! SWEP.Primary.Ammo = "smg1" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" //Firemode configuration SWEP.data = {} SWEP.mode = "semi" //The starting firemode SWEP.data.newclip = false //Do not change this SWEP.data.zoomfov = 45 SWEP.data.snipefov = 15 SWEP.data.scope = true SWEP.data.semi = {} SWEP.data.semi.Delay = 1.2 SWEP.data.semi.Cone = 0.07 SWEP.data.semi.ConeZoom = 0.001 //End of configuration function SWEP:Think() if SinglePlayer() then self.data.singleplayer(self) end if self.data.init then self.Weapon:SetClip1( self.Weapon:Clip1() - 1 ) self.data.init = nil end if self.data.newclip then if self.data.newclip == 0 then self.data.newclip = false if self:Ammo1() > self.Primary.ClipSize - 1 then if self.data.oldclip == 0 then self.Weapon:SetClip1( self.Weapon:Clip1() - 1 ) if SERVER then self.Owner:GiveAmmo(1,self.Primary.Ammo,true) end end end else self.data.newclip = self.data.newclip - 1 end end if self.rezoom then if self.rezoom <= CurTime() then self.Owner:SetFOV(self.zoomto,.3) self.rezoom = nil self.zoomto = nil end end end function SWEP:PrimaryAttack() if ( !self:CanPrimaryAttack() ) or self.data.newclip or self.data.init then return end if CLIENT then self.xhair.loss = self.xhair.loss + self.Primary.Recoil end --self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:SetNextPrimaryFire( CurTime() + self.data[self.mode].Delay ) self.Weapon:EmitSound(self.Primary.Sound) self:TakePrimaryAmmo( 1 ) self.Owner:ViewPunch( Angle( math.Rand(-0.2,-0.1) * self.Primary.Recoil, math.Rand(-0.1,0.1) *self.Primary.Recoil, 0 ) ) if self.Owner:GetFOV() == 90 then self:CSShootBullet( self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self.data[self.mode].Cone ) else self:CSShootBullet( self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self.data[self.mode].ConeZoom ) if SERVER then self.zoomto = self.Owner:GetFOV() self.Owner:SetFOV(90,.3) self.rezoom = CurTime() + self.data[self.mode].Delay end end end function SWEP:Deploy() if SERVER then self.zoomto = nil self.rezoom = nil end return true end function SWEP:SecondaryAttack() if ( !self:CanPrimaryAttack() ) or self.data.newclip or self.data.init or self.rezoom then return end if self.Owner:KeyDown(IN_USE) then self.data[self.mode].Init(self) elseif SERVER then if self.Owner:GetFOV() == 90 then self.Owner:SetFOV(self.data.zoomfov,.3) elseif self.Owner:GetFOV() == self.data.zoomfov and self.data.snipefov > 0 then self.Owner:SetFOV(self.data.snipefov,.3) else self.Owner:SetFOV(90,.3) end end end function SWEP:Reload() if SERVER and self.Owner:GetFOV() ~= 90 then self.Owner:SetFOV(90,.3) end self.data.oldclip = self.Weapon:Clip1() self.Weapon:DefaultReload(ACT_VM_RELOAD) self.data.newclip = 1 if SERVER then self.zoomto = nil self.rezoom = nil end end
i have very little knowledge of LUA but it seems [code]SWEP.Primary.NumShots = 4[/code] should say [code]SWEP.Primary.NumShots = 1[/code]
[QUOTE=Bman212;15927638]i have very little knowledge of LUA but it seems [code]SWEP.Primary.NumShots = 4[/code] should say [code]SWEP.Primary.NumShots = 1[/code][/QUOTE] Okay thanks but the height error is still their it seems to shoot and make sounds now but the gun is like high up in the air. [editline]03:36AM[/editline] [quote=crysismaster;15932852]okay thanks but the height error is still their it seems to shoot and make sounds now but the gun is like high up in the air.[/quote] please some one help me!
You have an extra underline for the "V model" AND you didn't need to re-name it. You could have just used the W model as the V model, save space add porn. :haw: As for the height, I don't know, maybe have some line, like ironsights, to position the gun properly.
[QUOTE=b00ce;15968222]You have an extra underline for the "V model" AND you didn't need to re-name it. You could have just used the W model as the V model, save space add porn. :haw: As for the height, I don't know, maybe have some line, like ironsights, to position the gun properly.[/QUOTE] I fixed it hooray! Here is the download link, [url]http://www.garrysmod.org/downloads/?a=view&id=72618[/url]
your welcome :)
[QUOTE=awatemonosan;16000859]your welcome :)[/QUOTE] Oh my god im so sorry i forgot about you,how could i you were the one who helped me fix it!
Hi, I am Andres Kramack from [url]http://www.cathybarryadultstore.com/[/url]. It's a 'pleasure' serving the public if you know what I mean and this message is Here at Cathy Barry Adult Store, we offer a wide variety of dildos that come in all sizes from goblin-sized dicks to black-man draconic dicks. I know at Facepunch everyone loves good old dicks which is why [B]I[/B] personally offer anyone with an association with Facepunch Forums a 50% discount code "DIL4FACEPUNCH". Don't forget, this offer lasts until the next Garry's Mod update which we so much love. Here are pictures of our products just for you! [IMG]http://pic.esmatube.com/imgs/a/g/t/x/x/giant_dildo_in_my_ass_part_ii-3_tmb.jpg[/IMG] [IMG]http://pic.esmatube.com/imgs/a/d/d/h/r/bbw_giant_dildo_squat_25cm_round-3_tmb.jpg[/IMG] [IMG]http://xxxdessert.com/tube/contents/videos_screenshots/15000/15261/preview.mp4.jpg[/IMG] [IMG]http://g04.a.alicdn.com/kf/HTB1JlHlIpXXXXaJXVXXq6xXFXXXo/Silicone-Huge-Dildos-Vibrator-for-woman-shake-Horse-Dildos-penis-swith-sucker-african-Dong-dildos.jpg[/IMG] Sponsored Images: [IMG]http://45.media.tumblr.com/f81f8d61fa253dc804edb423c8ab149f/tumblr_mfbk96QAug1rvbfkuo1_500.gif[/IMG] [IMG]http://49.media.tumblr.com/9110819111aa37acf4cd1c9d5341dd97/tumblr_nc4hqkdESo1skwv6ko1_500.gif[/IMG] [IMG]http://1.bp.blogspot.com/-gueWbSnnsIc/UUtenyLS0oI/AAAAAAAANF4/L4aZnTrMaqs/s1600/dermatologists-hate-her.jpg[/IMG] [IMG]http://static.fjcdn.com/pictures/Gym+leaders+hate+him_ab471d_5017861.jpg[/IMG] [IMG]https://static.fjcdn.com/comments/That+one+with+the+lamp+got+me+_e68beb19422eea14289caa5f4d6dffb7.jpg[/IMG] Got any questions? Visit my Steam Profile! [url]http://steamcommunity.com/id/Robotboy655[/url]
Sorry, you need to Log In to post a reply to this thread.