Jump to content

Teams Tag


nagugg

Recommended Posts

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 by Gordon_G
  • Like 1
Link to comment
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 by #_iMr.[E]coo
Link to comment

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 by Mr.Loki
added links :D
  • Like 1
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...