AddCSLuaFile("hands.lua") SWEP.ViewModel = ""--"models/error.mdl" SWEP.WorldModel = ""--"models/error.mdl" SWEP.HoldType = "normal" SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "none" SWEP.Secondary.Clipsize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" SWEP.DrawAmmo = false SWEP.DrawCrosshair = false function SWEP:Initialize() self:SetWeaponHoldType(self.HoldType) self:DrawShadow(false) self:SetNoDraw(true) --[[ if (CLIENT) then self.MOB = ClientsideModel("error.mdl") self.MOB:SetNoDraw(true) self.MOB:DrawShadow(false) end ]] end SWEP.Pickup = nil SWEP.PickupAngles = Angle(0,0,0) SWEP.PickupOffset = 100 function SWEP:DefaultPickup() if self.Pickup == nil then local tr = self.Owner:GetEyeTrace() local dist = self.Owner:GetPos():Distance(tr.HitPos) if dist < 100 and tr.Entity.GetMass and tr.Entity:GetMass() < 100 then self.Pickup = tr.Entity self.PickupAngles = tr.Entity:GetAngles() self.PickupOffset = dist end else self.Pickup = nil end end function SWEP:Tick() if self.Pickup ~= nil then --Set position local targetpos = (self.Owner:EyeAngles():Forward() * self.PickupOffset * 2) + self.Owner:GetPos() + Vector(0,0,64) local deltavel = targetpos - (self.Pickup:GetPos() + self.Pickup:GetVelocity()) local clampvel = Vector(math.Clamp(deltavel.x,-100,100),math.Clamp(deltavel.y,-100,100),math.Clamp(deltavel.z,-100,100)) self.Pickup:GetPhysicsObject():SetVelocity(clampvel) --Set angles local targetang = self.Owner:EyeAngles() + self.PickupAngles local angvel = self.Pickup:GetAngles() - targetang local deltaang = self.Pickup:GetPhysicsObject():GetAngleVelocity() - angvel:Forward() self.Pickup:GetPhysicsObject():AddAngleVelocity(angvel:Forward()) end end function SWEP:ShouldDropOnDie() return false end function SWEP:PrimaryAttack() if CLIENT then return end --Make sure we have an equipment inventory if not self.Owner then return end if not self.Owner.data then return end if not self.Owner.data.inventories then return end if not self.Owner.data.inventories[1] then return end local eqpd = self.Owner.data.inventories[1] --Get the weapon we want to fire, and fire it! local weapon = eqpd:Get({"Left Hand"}) or eqpd:Get({"Dual"}) if not weapon then self:DefaultPickup() elseif weapon.onClick ~= nil then weapon:onClick(self.Owner) end --Make sure we have a weapon end function SWEP:SecondaryAttack() if CLIENT then return end --Make sure we have an equipment inventory if not self.Owner then return end if not self.Owner.data then return end if not self.Owner.data.inventories then return end if not self.Owner.data.inventories[1] then return end local eqpd = self.Owner.data.inventories[1] --Get the weapon we want to fire, and fire it! local weapon = eqpd:Get({"Right Hand"}) or eqpd:Get({"Dual"}) if not weapon then self:DefaultPickup() elseif weapon.onClick ~= nil then weapon:onClick(self.Owner) end --Make sure we have a weapon end hook.Add("PlayerSpawn","give_hands",function(ply) ply:Give("hands") end)