• Ok im making a chain saw but.
    8 replies, posted
Ok i have a chain saw model i can get it in game but the problem is when i get the chain saw swep it appears on my head and also im wondering how i can make the chainsaw swing. You will probably need to see the script so here. [lua] if ( SERVER ) then AddCSLuaFile( "shared.lua" ) SWEP.HoldType = "Crowbar" end if ( CLIENT ) then SWEP.PrintName = "chainsaw" SWEP.Author = "zombiedance" SWEP.Slot = 1 SWEP.SlotPos = 7 SWEP.ViewModelFOV = 62 SWEP.IconLetter = "b" SWEP.Category = "Painful_sweps" end --------------------------------------------------- -- function SWEP:Reload() --To do when reloading -- end function SWEP:Think() -- Called every frame end function SWEP:Initialize() util.PrecacheSound("") end function SWEP:PrimaryAttack() self.Weapon:SetNextPrimaryFire(CurTime() + .4) local trace = self.Owner:GetEyeTrace() if trace.HitPos:Distance(self.Owner:GetShootPos()) <= 75 then self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER) bullet = {} bullet.Num = 1 bullet.Src = self.Owner:GetShootPos() bullet.Dir = self.Owner:GetAimVector() bullet.Spread = Vector(0, 0, 0) bullet.Tracer = 0 bullet.Force = 1 bullet.Damage = 80 self.Owner:FireBullets(bullet) self.Weapon:EmitSound("") else self.Weapon:EmitSound("" .. math.random( 1, 4 ) .. ".wav") self.Weapon:SendWeaponAnim(ACT_VM_MISSCENTER) end end function SWEP:Deploy() return true; end function SWEP:Holster() return true; end function SWEP:SecondaryAttack() self.Weapon:SetNextSecondaryFire(CurTime() + .4) local trace = self.Owner:GetEyeTrace() if trace.HitPos:Distance(self.Owner:GetShootPos()) <= 75 then self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER) bullet = {} bullet.Num = 1 bullet.Src = self.Owner:GetShootPos() bullet.Dir = self.Owner:GetAimVector() bullet.Spread = Vector(0, 0, 0) bullet.Tracer = 0 bullet.Force = 1 bullet.Damage = 25 self.Owner:FireBullets(bullet) self.Weapon:EmitSound("") else self.Weapon:EmitSound("") self.Weapon:SendWeaponAnim(ACT_VM_MISSCENTER) end end ------------------------------------------------------------------- SWEP.Author = "zombiedance" SWEP.Contact = "" SWEP.Purpose = "A chainsaw." SWEP.Instructions = "Primary or Secondary to slice" SWEP.Spawnable = false SWEP.AdminSpawnable = true ----------------------------------------------- SWEP.ViewModel = "models/weapons/v_chain2.mdl" SWEP.WorldModel = "models/weapons/w_chain2.mdl" ----------------------------------------------- SWEP.Primary.Delay = 0.3 SWEP.Primary.Recoil = 0 SWEP.Primary.Damage = 89 SWEP.Primary.NumShots = 1 SWEP.Primary.Cone = 0 SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "none" ------------------------------------------------- SWEP.Secondary.Delay = 60.999999999 SWEP.Secondary.Recoil = 0 SWEP.Secondary.Damage = 80 SWEP.Secondary.NumShots = 1 SWEP.Secondary.Cone = 0 SWEP.Secondary.ClipSize = 1 SWEP.Secondary.DefaultClip = 1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "pistol" ------------------------------------------------- [/lua]
Step 1 to getting help: please put [ lua] [/lua] tags (without the space) around your code so we can understand it a lot better.
kk There lol sorry first time. [editline]11:48PM[/editline] also i didnt make the model i got it from a person I DIDNT STEAL IT!
Does the chainsaw have animations? You can't make animations in Lua afaik, it has to be part of one of the model's files.
Oh actually it doesn't. I didn't make it but still how do i fix the saw being inside my head.
Don't know if that's possible either, then again I've never made models.
Aw i hope it is.
If there is a way in LUA to position it you will want to do that. But when modeling there is also an origin of the model that may need to be the in correct place.
aw ill have to either get a person to do that or drop the idea.
Sorry, you need to Log In to post a reply to this thread.