How would I make it so when someone does @ / runs ulx asay it prints a message

I have been trying to make it so when someone does @ it prints in their chat a message. This is the code so far



hook.Add( "PlayerSay", "Report", function( ply, text, team )
	if ( string.sub( text, 1, 1 ) == "@" ) then
		return Player:PrintMessage( HUD_PRINTTALK, "[Reports] You're call has been noted and you have been added to the queue. Please be patient!")
	end
end )


And when @ is used nothing does it.

What is Player? You never defined it. Also, PrintMessage doesn’t return anything so you may as well just do this:



hook.Add( "PlayerSay", "Report", function( ply, text, team )
	if ( string.sub( text, 1, 1 ) == "@" ) then
		ply:PrintMessage( HUD_PRINTTALK, "[Reports] You're call has been noted and you have been added to the queue. Please be patient!")
		return ""
	end
end )


Thank you for the help. Any way to change the string.sub so its if ulx asay is used

[editline]6th September 2016[/editline]

And how would I make the text coloured?

chat.AddText, send messages using the net library or whatever

Not sure if this would cause problems, or if you want to/should, but you can probably just add that section of code into the ulx asay code and use ulx’s variable for the player to simplify everything down.