golanu21 Posted February 27, 2013 Share Posted February 27, 2013 i want to make a script, when are the player in a team, to start a function Link to comment
tosfera Posted February 27, 2013 Share Posted February 27, 2013 wich team, wich function? edit: try this; addCommandHandler("startFunc", function ( source, commandName ) for i, players in ipairs(getElementType("player")) do local team = getPlayerTeam ( player ) if team then function_name_here(Parameters, here) end end end ) Link to comment
golanu21 Posted February 27, 2013 Author Share Posted February 27, 2013 i want to start a function, when the player are in Criminal team and i don't know how Link to comment
Metall Posted February 27, 2013 Share Posted February 27, 2013 function example(player) if(getPlayerTeam(player) == getTeamFromName("TeamName")) then -- do something else -- if not return -- return end end if(getPlayerTeam(player) == getTeamFromName("TeamName")) then Basiclly checks if the player is in that team, that's what i guess you want. For your request if in criminal team: if(getPlayerTeam(player) == getTeamFromName("Criminal")) then Link to comment
tosfera Posted February 27, 2013 Share Posted February 27, 2013 oh, try this then; addCommandHandler("startFunc", function ( source, commandName ) for i, players in ipairs(getElementType("player")) do local team = getPlayerTeam ( player ) if ( team and getTeamName(team) == "criminal" ) then function_name_here(Parameters, here) end end end ) Link to comment
golanu21 Posted February 27, 2013 Author Share Posted February 27, 2013 thx very mutch (((tosfera, Metall))) 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