5150 Posted October 12, 2015 Share Posted October 12, 2015 how can i make it so my script will read more than one team? i have a security system for A51 and it only allows my gang, Psycho Mans Gang in. i want the "Staff" team to have access too. what do i have to do here? function hit ( pla, dim ) if getElementType ( pla ) == "player" then local vehicle = getPlayerOccupiedVehicle ( pla ) if vehicle or not vehicle then if ( getTeamName(getPlayerTeam(pla)) == "Psycho Mans Gang" ) then outputChatBox ( "Welcome, "..getClientName(pla).."!", pla, 0, 150, 0 ) else setElementData ( pla, "inRestrictedArea", "true" ) triggerClientEvent ( pla, "destroyTrepassor", g_root, pla ) end end end end addEventHandler ( "onColShapeHit", g_base_col, hit ) Link to comment
DNL291 Posted October 12, 2015 Share Posted October 12, 2015 You can make a table with the allowed teams, like in this code: local allowedTeams = { ["Psycho Mans Gang"]=true, ["Staff"]=true } function hit ( pla, dim ) if getElementType ( pla ) == "player" then local vehicle = getPedOccupiedVehicle ( pla ) if getPlayerTeam(pla) and allowedTeams[getTeamName(getPlayerTeam(pla))] then outputChatBox ( "Welcome, "..getPlayerName(pla).."!", pla, 0, 150, 0 ) else setElementData ( pla, "inRestrictedArea", "true" ) triggerClientEvent ( pla, "destroyTrepassor", g_root, pla ) end end end addEventHandler ( "onColShapeHit", g_base_col, hit ) Link to comment
5150 Posted October 12, 2015 Author Share Posted October 12, 2015 ok thanks, and i need this for more than one part of the script... can i just put "local allowedTeams" in place of all getTeamNames? Link to comment
5150 Posted October 12, 2015 Author Share Posted October 12, 2015 im not the best with tables, or scripting lol Link to comment
Dealman Posted October 12, 2015 Share Posted October 12, 2015 Why not just add an or check? if(getTeamName(getPlayerTeam(pla)) == "Psycho Mans Gang" or getTeamName(getPlayerTeam(pla)) == "Staff") then 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