• How would I make it so when someone does @ / runs ulx asay it prints a message
    4 replies, posted
I have been trying to make it so when someone does @ it prints in their chat a message. This is the code so far [CODE] 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 ) [/CODE] 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: [CODE] 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 ) [/CODE]
[QUOTE=MPan1;51008415]What is Player? You never defined it. Also, PrintMessage doesn't return anything so you may as well just do this: [CODE] 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 ) [/CODE][/QUOTE] 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?
[QUOTE=Renzr;51008427]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?[/QUOTE] chat.AddText, send messages using the net library or whatever
[QUOTE=Renzr;51008427]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?[/QUOTE] 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.
Sorry, you need to Log In to post a reply to this thread.