Jump to content

Gate Help


|TSF|FoX

Recommended Posts

Hi i scripted this gate script, and i dont know how to add this gate open for group in DayZ gamemode and if player is not in clan than in chat you are not in the clan name can somone help me with that.And and other problem is when the gate is lv u can open it in ls how to add distance open??

  
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

well you can check the group using getAccountData, for example if your group system records the clan in an accountdata called "dayzclan" you can use:

local playerclan = getAccountData(source,"dayzclan") 

and then compare if the clan is allowed to open the gate:

if (playerclan == "exampleclan") then 
--whatever 
end 

For the distance thing, you can use what our friend here suggested, which is getDistanceBetweenPoints3D, an example, without me testing it, would be using the X Y and Z of the gate, and compare it to the players location:

local plx,ply,plz = getElementPosition(source) 
local distance = getDistanceBetweenPoints3D ( 8378,1064.3000488281,1771,19.700000762939, plx,ply,plz ) 
if (distance < "50") then 
--rest of the code 
end 
  

Link to comment
well you can check the group using getAccountData, for example if your group system records the clan in an accountdata called "dayzclan" you can use:
local playerclan = getAccountData(source,"dayzclan") 
  

You are wrong here.

Try this:

local acc = getPlayerAccount(source) 
local playerclan = getAccountData(acc, "dayzclan") 
  

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...