Fox261098 Posted April 8, 2016 Share Posted April 8, 2016 Hey how to add to only one group can open the door for dayz gamemode code local gate = createObject ( 10828, 276.60000610352, 2503.3000488281, 28.10000038147, 0, 0, 90 ) local state = 0 function move() if state == 0 then moveObject ( gate, 4000, 276.5, 2537.1999511719, 28.10000038147) state = state + 1 elseif state == 1 then moveObject ( gate, 4000, 276.60000610352, 2503.3000488281, 28.10000038147) state = state - 1 end end addCommandHandler("gate", move ) Link to comment
Fox261098 Posted April 8, 2016 Author Share Posted April 8, 2016 Hey how to add to only one group can open the door for dayz gamemode code local gate = createObject ( 10828, 276.60000610352, 2503.3000488281, 28.10000038147, 0, 0, 90 ) local state = 0 function move() if state == 0 then moveObject ( gate, 4000, 276.5, 2537.1999511719, 28.10000038147) state = state + 1 elseif state == 1 then moveObject ( gate, 4000, 276.60000610352, 2503.3000488281, 28.10000038147) state = state - 1 end end addCommandHandler("gate", move ) Link to comment
KariiiM Posted April 8, 2016 Share Posted April 8, 2016 Where's the group's element data? Link to comment
KariiiM Posted April 8, 2016 Share Posted April 8, 2016 Where's the group's element data? Link to comment
Fox261098 Posted April 8, 2016 Author Share Posted April 8, 2016 Where's the group's element data? Whad do you mean elemet data??? Link to comment
Fox261098 Posted April 8, 2016 Author Share Posted April 8, 2016 Where's the group's element data? Whad do you mean elemet data??? Link to comment
KariiiM Posted April 9, 2016 Share Posted April 9, 2016 You want only group members who can open the door right? Link to comment
KariiiM Posted April 9, 2016 Share Posted April 9, 2016 You want only group members who can open the door right? Link to comment
KariiiM Posted April 9, 2016 Share Posted April 9, 2016 Yea Okay, Is there's any function exported return player's group name ? Link to comment
KariiiM Posted April 9, 2016 Share Posted April 9, 2016 Yea Okay, Is there's any function exported return player's group name ? Link to comment
Fox261098 Posted April 9, 2016 Author Share Posted April 9, 2016 Im asking how to make on that gate script only team members from the group can open the door Link to comment
aka Blue Posted April 9, 2016 Share Posted April 9, 2016 Try this: local gate = createObject ( 10828, 276.60000610352, 2503.3000488281, 28.10000038147, 0, 0, 90 ) local state = 0 local team = "teamname" addCommandHandler ( "gate", function ( ) if getPlayerTeam ( source ) == team then if state == 0 then moveObject ( gate, 4000, 276.5, 2537.1999511719, 28.10000038147) state = 1 elseif state == 1 then moveObject ( gate, 4000, 276.60000610352, 2503.3000488281, 28.10000038147) state = 0 end end end ) Link to comment
Fox261098 Posted April 9, 2016 Author Share Posted April 9, 2016 Try this: local gate = createObject ( 10828, 276.60000610352, 2503.3000488281, 28.10000038147, 0, 0, 90 ) local state = 0 local team = "teamname" addCommandHandler ( "gate", function ( ) if getPlayerTeam ( source ) == team then if state == 0 then moveObject ( gate, 4000, 276.5, 2537.1999511719, 28.10000038147) state = 1 elseif state == 1 then moveObject ( gate, 4000, 276.60000610352, 2503.3000488281, 28.10000038147) state = 0 end end end ) not working Link to comment
aka Blue Posted April 9, 2016 Share Posted April 9, 2016 ¿Do you set the team name here? local team = "teamname" Link to comment
Simple0x47 Posted April 9, 2016 Share Posted April 9, 2016 Fox, if you're using MTA DayZ 0.95a. Add this to "DayZ/group/group.slua" function isPlayerInGroup(player, group) if GAC[GetAccount(player)][1] == group then return true else return false end end Now your script. local gate = createObject ( 10828, 276.60000610352, 2503.3000488281, 28.10000038147, 0, 0, 90 ) local state = 0 local group = "TheGroupYouWant" addCommandHandler ( "gate", function ( ) if isPlayerInGroup ( source, group ) then if state == 0 then moveObject ( gate, 4000, 276.5, 2537.1999511719, 28.10000038147) state = 1 elseif state == 1 then moveObject ( gate, 4000, 276.60000610352, 2503.3000488281, 28.10000038147) state = 0 end end end ) Link to comment
Simple0x47 Posted April 10, 2016 Share Posted April 10, 2016 not working Anyway you don't know how to make anything. So guys please close this thread, it cannot be solved. Link to comment
Dealman Posted April 10, 2016 Share Posted April 10, 2016 not working Anyway you don't know how to make anything. So guys please close this thread, it cannot be solved. Hey now, that's not very nice. He's as entitled to getting help here as anyone else is. Blue Pie's would work but he made a mistake, getPlayerTeam returns a team element, not a team name. The fix is simple, use getTeamName to check if the name of the team matches. local gate = createObject(10828, 276.60000610352, 2503.3000488281, 28.10000038147, 0, 0, 90) local state = 0 local theTeam = "TeamName" function move() if(getTeamName(getPlayerTeam(localPlayer)) == theTeam) then if(state == 0) then moveObject(gate, 4000, 276.5, 2537.1999511719, 28.10000038147) state = 1 elseif(state == 1) then moveObject(gate, 4000, 276.60000610352, 2503.3000488281, 28.10000038147) state = 0 end else outputChatBox("#BB0000You're not allowed to open this gate!", 0, 0, 0, true) end end addCommandHandler("gate", move) You'll also want to use Debugging to see what kind of warnings and/or errors you are receiving. It will help you fix them yourself and help us help you faster. Link to comment
Fox261098 Posted April 11, 2016 Author Share Posted April 11, 2016 not working Anyway you don't know how to make anything. So guys please close this thread, it cannot be solved. Hey now, that's not very nice. He's as entitled to getting help here as anyone else is. Blue Pie's would work but he made a mistake, getPlayerTeam returns a team element, not a team name. The fix is simple, use getTeamName to check if the name of the team matches. local gate = createObject(10828, 276.60000610352, 2503.3000488281, 28.10000038147, 0, 0, 90) local state = 0 local theTeam = "TeamName" function move() if(getTeamName(getPlayerTeam(localPlayer)) == theTeam) then if(state == 0) then moveObject(gate, 4000, 276.5, 2537.1999511719, 28.10000038147) state = 1 elseif(state == 1) then moveObject(gate, 4000, 276.60000610352, 2503.3000488281, 28.10000038147) state = 0 end else outputChatBox("#BB0000You're not allowed to open this gate!", 0, 0, 0, true) end end addCommandHandler("gate", move) You'll also want to use Debugging to see what kind of warnings and/or errors you are receiving. It will help you fix them yourself and help us help you faster. Ty man i fix it you the best :DD 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