Who Sprayed Spray

How can I make something in Lua that when an admin looks at a spray, it says who sprayed it?

i think i have just the thing

Like Draw it on your screen or print it to console or what? More details homie!

First step would be getting the sprayers eye trace and get the spray position, then send it to the clients.

Now store the spray position assosiated with the player and and draw the players name above the spray if it is visible.

If you think it’s that easy go code it and show us an example.

How about you ask nicely for an example, so you can learn from it as well. Stop being a jackass

But it is that easy to code, you must suck at Lua if you think it’s not.

[lua]
if SERVER then
hook.Add(‘PlayerSpray’, 0, function(ply)
local pos = ply:GetEyeTrace().HitPos

	if ply:GetEyeTrace().Entity == Entity(0) then
		umsg.Start("player_spray")
			umsg.Entity(ply)
			umsg.Vector(pos)
		umsg.End()
	end
end

elseif CLIENT then
local SprayPos = {}

usermessage.Hook("player_spray", function(um)
	local ply = um:ReadEntity()
	local pos = um:ReadVector()

	if ply:IsValid() then
		SprayPos[ply:Nick()] = pos
	end
end)

hook.Add("HUDPaint", 0, function()
	for name, pos in pairs(SprayPos) do
		local screenPos = pos:ToScreen()
		draw.SimpleText(name, "UIBold", screenPos.x, screenPos.y, Color(255, 0, 0, 255))
	end
end)

end
[/lua]

Make sure to check that the player’s EyeTrace is hitting worldspawn, since the spray wouldn’t be there otherwise.

Fixed.

if ply:GetEyeTrace().HitWorld then

Forgot about that :L