Jump to content

Team Help


Recommended Posts

See this code it's server side script learn from it :

local Criminal = createTeam ( "Criminal" , 155 , 0 ,0 ) -- Create a New Team With 'Criminal' Name 
  
addCommandHandler ( "Criminal" , -- Add 'Criminal' Command Handler 
    function ( player ) -- Create a New Function . 
        if ( isElement ( player ) ) then -- Check The Player Element. 
        if ( getTeamName(getPlayerTeam(player)) ==  ( "Criminal" ) ) then -- Check If The Player Already On The 'Criminal' Team . 
            outputChatBox("* You Are Already On The 'Criminal' Team!",player,255,0,0) -- Output On The Chat For The Player .  
            return end -- Return and Stop The Function . 
            setPlayerTeam ( player , Criminal ) -- Here If The Player Wasn't In The 'Team' Then Set It Into The Team! 
            outputChatBox("* You Have Been Joined Into The 'Criminal' Team! ",player,155,0,0) -- Output On The Chat For The Player . 
        end -- Close 
    end -- Close 
)-- Close 
Link to comment

i made another one from scratch so create a new lua file named "server" without quotes witch containes this code:

local Criminal = createTeam ( "Criminal", 155, 0, 0 ) 
  
function putPlayerInTeam ( player ) 
    if ( isElement ( player ) ) then 
        if ( getPlayerTeam ( player ) == getTeamFromName ( "Criminal" )) then 
        outputChatBox("* You Are Already On The 'Criminal' Team!",player,255,0,0) 
        return end 
        setPlayerTeam ( player , Criminal ) 
        outputChatBox("* You Have Been Joined Into The 'Criminal' Team! ",player,155,0,0) 
    end 
end 
  
addCommandHandler ( "criminal", putPlayerInTeam ) 
  

and don't forget to create "meta.xml" file witch contains:

<meta> 
    <script src="server.lua" type="server" /> 
</meta>  

note: mta.xml must be in the same folder with server.lua

hope it helps

Link to comment
addCommandHandler ( "criminal", function ( player ) 
    if getPlayerTeam ( player ) == getTeamFromName ( "Criminal" ) then 
        outputChatBox("* You Are Already On The 'Criminal' Team!",player,255,0,0)        
    else 
        setPlayerTeam ( player , Criminal ) 
        outputChatBox("* You Have Been Joined Into The 'Criminal' Team! ",player,155,0,0) 
    end 
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...