I wanna tell a player who owns the prop he is looking at, but then i found out that the :GetOwner() only works if you set it....
Just like this:
print( LocalPlayer():GetEyeTrace().Entity:GetPropSpawner() )
There are no default "owner" functions in Garrysmod.
ent:SetOwner() are used for weapons being equipped (Disables collisions .. ect).
You can set a variable on the prop using hooks:
[lua]--SERVER
hook.Add("PlayerSpawnedProp","TinyCPPI_Prop",function(ply,_,ent)
ent:SetNWEntity("my_owner",ply)
end)
-- Can be used on server and client:
local owner = ent:GetNWEntity("my_owner")
[/lua]
Or use a prop protection addon (Default in DarkRP)
[lua]ent:GetCPPIOwner()[/lua]
You can check if you got prop protection with CPPI being a table.
You can read more about the comment prop protection interface (CPPI) [url=http://ulyssesmod.net/archive/CPPI_v1-3.pdf]here[/url].
Or you could just open your console
Sorry read it wrong
Sorry, you need to Log In to post a reply to this thread.