Need Help Making SWEP

Hi, I’ve just recently learned how to make SWEPs. I am trying to make a gun that causes a message to be printed on a players HUD. For this, I need to know how to get a player’s ID number in the game by shooting them. Can anybody help me with this?

By ID, do you mean the player’s Steam ID, his Unique ID or his entity ID? You don’t need the latter to print a message on the screen of a specific player.

I think he mean entityID

Yeah, I meant entity ID. Thanks

EDIT: I meant thanks for clarification, I still need help with the Lua.

this may help.
**Returning the Entity the Player is Looking At **

On a clientside script:

local ent = LocalPlayer():GetEyeTrace().Entity
if (ent:IsValid()) then
 //yup, its a valid entity!
end

Returns the entity the specified player is looking at, if the entity is not valid it will return false

function TraceEntity(ply)
local ent = ply:GetEyeTrace().Entity
if ValidEntity(ent) then
return ent
end
return false
end

found it here