Jump to content

[Help]Gates


Recommended Posts

this is my gates now how to make it openned by acl group members?

local gate = createObject(980, 1128.3000488281, -1541.0999755859, 16.10000038147, 0, 0, 180) 
local marker = createMarker(1128.3000488281, -1543.5999755859, 13.300000190735, "cylinder", 2, 255, 255, 255, 255) 
  
function moveGate(hitPlayer, matchingDimension) 
    if hasObjectPermissionTo(hitPlayer, "function.kickPlayer") then 
        moveObject(gate, 2000, 1118, -1541.0999755859, 16.10000038147) 
        setTimer(moveBack, 2000, 1) 
    end 
end 
addEventHandler("onMarkerHit", marker, moveGate) 
  
function moveBack() 
    moveObject(gate, 2000, 1128.3000488281, -1541.0999755859, 16.10000038147) 
end 

Link to comment
local gate = createObject ( 980, 1128.3000488281, -1541.0999755859, 16.10000038147, 0, 0, 180 ) 
local marker = createMarker ( 1128.3000488281, -1543.5999755859, 13.300000190735, "cylinder", 2, 255, 255, 255, 255 ) 
  
function moveGate ( hitPlayer, matchingDimension ) 
    if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( hitPlayer ) ), aclGetGroup ( "Admin" ) ) then 
        moveObject ( gate, 2000, 1118, -1541.0999755859, 16.10000038147 ) 
        setTimer ( moveBack, 2000, 1 ) 
    end 
end 
addEventHandler ( "onMarkerHit", marker, moveGate ) 
  
function moveBack ( ) 
    moveObject ( gate, 2000, 1128.3000488281, -1541.0999755859, 16.10000038147 ) 
end 

Link to comment

It gonna bugs if you use a vehicle to enter as the hitElement is an vehicle now, not player.

This will work, added getElementType.

  
local gate = createObject ( 980, 1128.3000488281, -1541.0999755859, 16.10000038147, 0, 0, 180 ) 
local marker = createMarker ( 1128.3000488281, -1543.5999755859, 13.300000190735, "cylinder", 2, 255, 255, 255, 255 ) 
  
function moveGate ( hitPlayer, matchingDimension ) 
    if getElementType(hitPlayer) =="player" and isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( hitPlayer ) ), aclGetGroup ( "Admin" ) ) then 
        moveObject ( gate, 2000, 1118, -1541.0999755859, 16.10000038147 ) 
        setTimer ( moveBack, 2000, 1 ) 
    end 
end 
addEventHandler ( "onMarkerHit", marker, moveGate ) 
  
function moveBack ( ) 
    moveObject ( gate, 2000, 1128.3000488281, -1541.0999755859, 16.10000038147 ) 
end 
  
  
  

Link to comment
yes -_- i just need that onMarkerLeav Script
  
function EDIT ( hitPlayer, matchingDimension ) -- Need edit 
    if getElementType(hitPlayer) =="player" and isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( hitPlayer ) ), aclGetGroup ( "Admin" ) ) then 
        moveObject ( gate, 2000, new coords ) -- need edit 
    end 
end 
addEventHandler ( "Edit the eventHandler", marker, EDIT!! ) -- Need edit 
  
  

It can take less than 1 minute if you know the coords already else 2 minutes :)

Link to comment

Try this:

local gate = createObject ( 980, 1128.3000488281, -1541.0999755859, 16.10000038147, 0, 0, 180 ) 
local marker = createMarker ( 1128.3000488281, -1543.5999755859, 13.300000190735, "cylinder", 2, 255, 255, 255, 255 ) 
  
function moveGate ( hitPlayer, matchingDimension ) 
    if ( getElementType ( hitPlayer ) == "player" ) and isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( hitPlayer ) ), aclGetGroup ( "Admin" ) ) then 
        if ( eventName == "onMarkerHit" ) then 
            moveObject ( gate, 2000, 1118, -1541.0999755859, 16.10000038147 ) 
            setTimer ( moveBack, 2000, 1 ) 
        elseif ( eventName == "onMarkerLeave" ) then 
            moveBack ( ) 
        end 
    end 
end 
addEventHandler ( "onMarkerHit", marker, moveGate ) 
addEventHandler ( "onMarkerLeave", marker, moveGate ) 
  
function moveBack ( ) 
    moveObject ( gate, 2000, 1128.3000488281, -1541.0999755859, 16.10000038147 ) 
end 

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...