nagugg Posted February 28, 2017 Share Posted February 28, 2017 How can I create a chat tag for a team? (not a tag for an ACL team) Example: if you are in the team "Az" your nick is: |Az|name Link to comment
Mr.Loki Posted March 4, 2017 Share Posted March 4, 2017 onPlayerChat cancelEvent getPlayerTeam getTeamName getPlayerName outputChatBox 2 Link to comment
Gordon_G Posted March 4, 2017 Share Posted March 4, 2017 (edited) Damn it. Hum... You will need these function : getPlayerTeam() -- Get the player's team when he disconnect getTeamName() -- Because getPlayerTeam() returns a userdata value but we need a string setAccountData() -- Save the player's team on quit getAccountData() -- Get player team when he disconnected getTeamFromName() -- Because our account data is a string, not a userdata setPlayerTeam() -- Set player team when he joins getPlayerName() -- Take the player name setPlayerName() -- Add to the name the team name Ask if you have any other question. EDIT : Loki, you're too fast for me x'( Edited March 4, 2017 by Gordon_G 1 Link to comment
^iiEcoo'x_) Posted March 5, 2017 Share Posted March 5, 2017 (edited) addEventHandler ("onPlayerChat",root, function ( msg ) if getPlayerTeam ( source ) then cancelEvent () local PlrTeam = getTeamFromName ( getPlayerTeam ( source ) ) outputChatBox ("[ "..PlrTeam.." ] "..getPlayerName ( source ).." : "..msg , root , 255 , 255 , 255 , true ) end end ) Try this Edited March 5, 2017 by #_iMr.[E]coo Link to comment
Mr.Loki Posted March 6, 2017 Share Posted March 6, 2017 (edited) In line 5 getTeamFromName should be getTeamName because getTeamFromName returns a team not the name. I added the color code to the team tag: addEventHandler ("onPlayerChat",root, function ( msg ) if getPlayerTeam ( source ) then cancelEvent () local plrTeam = getPlayerTeam ( source ) local teamName = getTeamName(plrTeam) local r,g,b = getTeamColor( plrTeam ) outputChatBox ("[ "..teamName.." ]#FFFFFF "..getPlayerName ( source ).." : "..msg , root , r, g, b, true ) end end ) Edited March 6, 2017 by Mr.Loki added links :D 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now