SWEP.Author = "Demivion"
SWEP.Contact = ""
SWEP.Purpose = ""
SWEP.Instructions = "Left click to select an NPC, right click to move the NPC"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.ViewModel = "models/weapons/v_pistol.mdl"
SWEP.WorldModel = "models/weapons/w_pistol.mdl"
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.NPC = nil
if (SERVER) then
AddCSLuaFile("shared.lua")
end
function SWEP:Reload()
end
function SWEP:Think()
end
function SWEP:PrimaryAttack()
local tr = {}
tr.start=self.Owner:GetShootPos() -- self.Owner is the player holding the swep
tr.endpos=self.Owner:GetAimVector()*2000000 -- the players aimvector =)
tr.filter=self.Owner
local Trace = util.TraceLine(tr)
if Trace.Entity && Trace.Entity:IsNPC() then
self.NPC = Trace.Entity
end
end
function SWEP:SecondaryAttack()
local tr = {}
tr.start=self.Owner:GetShootPos() -- self.Owner is the player holding the swep
tr.endpos=self.Owner:GetAimVector()*2000000 -- the players aimvector =)
tr.filter=self.Owner
local Trace = util.TraceLine(tr)
if Trace.Hit then
local HP = Trace.HitPos
self.NPC:SetLastPosition( HP )
self.NPC:SetSchedule( 71 )
end
end