Spawn At Eye Trace

Hi! im wondering how to make an entity spawn where your looking? i tried GetEyeTrace but that didnt work?

i have the entity and console command sorted just the spawn pos

do ulx ent {name} in console

[editline]17th May 2015[/editline]

so ulx ent drug_dealer

haha im not on about ulx, im on about in lua!

Player:GetEyeTrace is the correct way. When you tried the first time you did understand that GetEyeTrace returns a TraceResult table?

Also take a look at the base_entity SpawnFunction


 
local spawningpos = Player:GetEyeTrace().HitPos

local ent = ents.Create( insert your entity name here)
ent:SetPos( spawningpos )
ent:Spawn()
ent:Activate()



thanks!