Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. function colouredChat ( message, theType )
  2. if theType == 0 then --if its normal chat (not /me or teamchat) then
  3. cancelEvent() --prevent MTA from outputting chat
  4. message = string.gsub(message, "#%x%x%x%x%x%x", "") --remove any hex tags in a player's chat to prevent custom colours by using lua's string.gsub
  5. local r,g,b = getPlayerNametagColor ( source ) --get the player's nametag colour
  6. local chatterName = getPlayerName ( source ) --get his name
  7. --output a message with the name as his nametag colour, and the rest in white.
  8. outputChatBox ( chatterName..":#FFFFFF "..message, getRootElement(), 255, 255, 255, true )
  9. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement