Code | function makeKleiner(ply)
kleiner = ents.Create("npc_kleiner") // Creating the npc.
kleiner:SetPos(ply:GetEyeTrace().HitPos) // setting it's position where the player is looking at.
kleiner:Spawn() // Spawning it.
end
concommand.Add("makeKleiner", makeKleiner ) // Linking the concommand makeKleiner to the function of the same name.
function moveKleiner(ply)
kleiner:SetLastPosition( util.QuickTrace( ply:GetShootPos(), ply:GetAimVector()*1000 ).HitPos ) // Giving the previously spawned NPC a target.
kleiner:SetSchedule( SCHED_FORCED_GO ) // Ordering him to reach it.
end
concommand.Add("moveKleiner", moveKleiner )
function stopKleiner()
kleiner:StopMoving() // Ordering him to stop moving.
end
concommand.Add("stopKleiner", stopKleiner ) |