|TSF|FoX Posted December 28, 2016 Share Posted December 28, 2016 Hello everybody i made a gate script but now i want to make it a clan base on dayz gamemode but everybody can open it i use the regular group system witch comes with dayz the code local gate = createObject ( 8378,1064.3000488281,1771,19.700000762939,0,0,0 ) local state = 0 function move() if state == 0 then moveObject ( gate,4000,1064.3000488281,1771.0999755859,40.099998474121) state = state + 1 elseif state == 1 then moveObject ( gate, 4000,1064.3000488281,1771,19.700000762939) state = state - 1 end end addCommandHandler("gate", move ) Link to comment
bosslorenz Posted December 28, 2016 Share Posted December 28, 2016 It is because you did not put limitations on who can enter that command. Check your group system for getting the Gang of the account who enters that command. Link to comment
|TSF|FoX Posted December 28, 2016 Author Share Posted December 28, 2016 Im new at scripting so i dont know how to make and i said can somone teach me not like that Link to comment
iPrestege Posted December 28, 2016 Share Posted December 28, 2016 I'm not sure how you can check the group in dayz but i guess something like this : if getElementData ( player,'Group' ) == 'MyGroup' then -- Open and close. @Tekken Maybe you can confirm the way that what method is dayz doing to check the group. Link to comment
|TSF|FoX Posted December 28, 2016 Author Share Posted December 28, 2016 where to put that? Link to comment
Dimos7 Posted December 28, 2016 Share Posted December 28, 2016 local gate = createObject ( 8378,1064.3000488281,1771,19.700000762939,0,0,0 ) local state = 0 function move(thePlayer) if getElementData(thePlayer, "group") == "Your group name here" then if state == 0 then moveObject ( gate,4000,1064.3000488281,1771.0999755859,40.099998474121) state = state + 1 elseif state == 1 then moveObject ( gate, 4000,1064.3000488281,1771,19.700000762939) state = state - 1 end end end addCommandHandler("gate", move ) Link to comment
|TSF|FoX Posted December 28, 2016 Author Share Posted December 28, 2016 doesnt work for me Link to comment
myonlake Posted December 28, 2016 Share Posted December 28, 2016 4 minutes ago, |TSF|FoX said: doesnt work for me Where did you download the DayZ gamemode so I can have a look at it. Link to comment
itHyperoX Posted December 28, 2016 Share Posted December 28, 2016 (edited) u welcome local opencommand = "gate" --open command local closecommand = "gate1" --close command local ACL = "Server Owner" --acl local GateObject = 3036 --object local OpenTime = 6000 --opening second local rotX, rotY, rotZ = 0, 0, 90 --rotations local Defx, Defy, defz = 2055, -1697, 14.199999809265 --closed position local opx, opy, opz = 2055, -1697, 10 --opened position --create the gate (DO NOT EDIT) local ggate = createObject ( GateObject, Defx, Defy, defz, rotX, rotY, rotZ) --DO NOT EDIT function gateopen ( p ) if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(p)), aclGetGroup(ACL)) then moveObject (ggate, OpenTime, opx, opy, opz) outputChatBox("gate open", p,0,255,0,true) else outputChatBox("u dont have permission", p,0,255,0,true) end end addCommandHandler( opencommand, gateopen) function gateclose ( p ) if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(p)), aclGetGroup(ACL)) then moveObject (ggate, OpenTime, Defx, Defy, defz) outputChatBox("gate closing", p,0,255,0,true) else outputChatBox("u dont have permission", p,0,255,0,true) end end addCommandHandler( closecommand, gateclose) Edited December 28, 2016 by MilOG ww Link to comment
bosslorenz Posted December 28, 2016 Share Posted December 28, 2016 1 hour ago, Dimos7 said: local gate = createObject ( 8378,1064.3000488281,1771,19.700000762939,0,0,0 ) local state = 0 function move(thePlayer) if getElementData(thePlayer, "group") == "Your group name here" then if state == 0 then moveObject ( gate,4000,1064.3000488281,1771.0999755859,40.099998474121) state = state + 1 elseif state == 1 then moveObject ( gate, 4000,1064.3000488281,1771,19.700000762939) state = state - 1 end end end addCommandHandler("gate", move ) How can we even make the script work for you, tell us if your group system have export functions. If yes, then put it here. Link to comment
|TSF|FoX Posted December 28, 2016 Author Share Posted December 28, 2016 i downloaded it from here Link to comment
myonlake Posted December 28, 2016 Share Posted December 28, 2016 (edited) Well, I suppose you can then call this instead of that getElementData in the reply above. if ( not isGuestAccount( getPlayerAccount( thePlayer ) ) and ( isGangMember( 'yourGangName', getAccountName( getPlayerAccount( thePlayer ) ) ) ) then -- Your gate script end You will need to execute the gate script inside the DayZ resource, as otherwise it'll not be able to find the isGangMember function that is included in the resource. Edited December 28, 2016 by myonlake Link to comment
Tekken Posted December 29, 2016 Share Posted December 29, 2016 (edited) 14 hours ago, myonlake said: Well, I suppose you can then call this instead of that getElementData in the reply above. if ( not isGuestAccount( getPlayerAccount( thePlayer ) ) and ( isGangMember( 'yourGangName', getAccountName( getPlayerAccount( thePlayer ) ) ) ) then -- Your gate script end You will need to execute the gate script inside the DayZ resource, as otherwise it'll not be able to find the isGangMember function that is included in the resource. An easier method will be to do it like this: local gang = getElementData(player, "gang") or false; local thegang = "THEGANGNAME"; if (gang and gang == thegang) then -- Move the gate! end Also no need to run in DayZ, it can be a stand alone resource. Sorry haven't seen the posts above Edited December 29, 2016 by Tekken Link to comment
myonlake Posted December 29, 2016 Share Posted December 29, 2016 (edited) 7 hours ago, Tekken said: An easier method will be to do it like this: local gang = getElementData(player, "gang") or false; local thegang = "THEGANGNAME"; if (gang and gang == thegang) then -- Move the gate! end Also no need to run in DayZ, it can be a stand alone resource. Sorry haven't seen the posts above Sure, you can do that, but that kinda takes away the whole point of having functions in scripting languages in general. What if that element data key changes? You'll need to replace that everywhere. That's why we use functions. And instead of doing all that weird code, you can simply just write this and it'll do the same thing. if ( getElementData( thePlayer, 'gang' ) == 'yourGangName' ) then -- Your gate script end Edited December 29, 2016 by myonlake 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