Jump to content

team help


bartje01

Recommended Posts

Hey all. I was wondering how this works. I want that if you type: "strike", it'll check if you're in the strikeforce.

I have this:

  
function strike ( source ) 
     
    if ( playerTeam(source) == "Strike Force")then               
         
    else 
        outputChatBox ( getPlayerName ( source ) .. " You're not in strike force" ) 
    
end 
addCommandHandler ( "strike", strike ) 
  

Well, it didn't work :P. Could someone explain me how it does work?

Link to comment
Guest Guest4401
function strike(source) 
    if getPlayerTeam(source) and getPlayerTeam(source) == getTeamFromName("Strike Force") then -- You must check if the player is in a team & also check if the player's team is Strike Force. You must compare either team elements or team names. 
        outputChatBox("You are in strike force team",source) 
    else 
        outputChatBox("You are not in strike force team",source) 
    end -- You had forgotten an end 
end 
addCommandHandler ("strike",strike) 

Link to comment
Guest Guest4401
and how can i make it defined ?

First parametre of addCommandHandler is the player element.

Take a look carefully at the serverside syntax & examples.

https://wiki.multitheftauto.com/wiki/AddCommandHandler

addCommandHandler("test", 
    function() 
        --source is nil 
    end 
) 
  
addCommandHandler("test", 
    function(source) 
        --source is player element 
    end 
) 
  
addCommandHandler("test", 
    function(blabla) 
        --blabla is player element 
    end 
) 

Edited by Guest4401
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...