Jump to content

How to make sub-teams?


MetaGamer

Recommended Posts

Team = createTeam( "Police", 0, 0, 255 ) 
  
addCommandHandler( "duty", 
function( thePlayer, cmd ) 
setElementData( thePlayer, "Sheriff", true ) 
setPlayerTeam( thePlayer, Team ) 
end ) 
  
addCommandHandler( "check", 
function( thePlayer, cmd ) 
local SubTeam = getElementData( thePlayer, "Sheriff" ) 
local MainTeam = getTeamName( getPlayerTeam( thePlayer ) ) 
outputChatBox( "Your Mainteam is :"..MainTeam..", and your Subteam is :"..SubTeam..".", thePlayer, 0, 0, 255 ) 
end ) 

Link to comment
Team = createTeam( "Police", 0, 0, 255 ) 
  
addCommandHandler( "duty", 
function( thePlayer, cmd ) 
setElementData( thePlayer, "Sheriff", true ) 
setPlayerTeam( thePlayer, Team ) 
end ) 
  
addCommandHandler( "check", 
function( thePlayer, cmd ) 
local SubTeam = getElementData( thePlayer, "Sheriff" ) 
local MainTeam = getTeamName( getPlayerTeam( thePlayer ) ) 
outputChatBox( "Your Mainteam is :"..MainTeam..", and your Subteam is :"..SubTeam..".", thePlayer, 0, 0, 255 ) 
end ) 

actually it will error with "attempt to concatenate boolean", since the element data contains true, and not a team name.

Team = createTeam( "Police", 0, 0, 255 ) 
  
addCommandHandler( "duty", function( thePlayer, cmd ) 
  setElementData( thePlayer, "SubTeam", "Sheriff" ) 
  setPlayerTeam( thePlayer, Team ) 
end ) 
  
addCommandHandler( "check", function( thePlayer, cmd ) 
  local SubTeam = getElementData( thePlayer, "SubTeam" ) or "None" 
  local MainTeam = getTeamName( getPlayerTeam( thePlayer ) ) 
  outputChatBox( "Your Mainteam is: "..MainTeam..", and your Subteam is: "..SubTeam..".", thePlayer, 0, 0, 255 ) 
end ) 

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...