5150 Posted October 12, 2015 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 ) Paid Roleplay Mapper/Server Management - Message on forums or Discord for info Fluent with Owlgaming Code. Discord message for paid full set-ups and help My Discord: 5150#5150 (or .5150) Monky Gaming Roleplay/Adventure Discord (English players and servers interested in collaborating or partnering message me) https://discord.gg/SFBUHknpxy
DNL291 Posted October 12, 2015 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 ) Please do not PM me with scripting related question nor support, use the forums instead.
5150 Posted October 12, 2015 Author 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? Paid Roleplay Mapper/Server Management - Message on forums or Discord for info Fluent with Owlgaming Code. Discord message for paid full set-ups and help My Discord: 5150#5150 (or .5150) Monky Gaming Roleplay/Adventure Discord (English players and servers interested in collaborating or partnering message me) https://discord.gg/SFBUHknpxy
5150 Posted October 12, 2015 Author Posted October 12, 2015 im not the best with tables, or scripting lol Paid Roleplay Mapper/Server Management - Message on forums or Discord for info Fluent with Owlgaming Code. Discord message for paid full set-ups and help My Discord: 5150#5150 (or .5150) Monky Gaming Roleplay/Adventure Discord (English players and servers interested in collaborating or partnering message me) https://discord.gg/SFBUHknpxy
Dealman Posted October 12, 2015 Posted October 12, 2015 Why not just add an or check? if(getTeamName(getPlayerTeam(pla)) == "Psycho Mans Gang" or getTeamName(getPlayerTeam(pla)) == "Staff") then If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.
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