Jump to content

[HELP]Gates Moving by ACL Team


Recommended Posts

local allowedGroups = { "FBI"=true } 
col1 = createColSphere ( 927.4365234375, -1022.5947265625, 35.913665771484, 27.5 ) 
gate1 = createObject (3113, 941.1669921875, -1012.3310546875, 32.369918823242, 0, 15, 272.5) 
  
function openGate1 ( player ) 
if ( allowedGroups  getElementData ( player, "FBI" )  ) then 
moveObject (gate1, 941.1669921875, -1012.3310546875, 21.369918823242, 0, 15, 272.5 ) 
end 
end 
addEventHandler("onColShapeHit", col1, openGate1) 
  
function closeGate1() 
moveObject(gate1, 3037, 941.1669921875, -1012.3310546875, 32.369918823242, 0, 15, 272.5) 
end 
addEventHandler("onColShapeLeave", col1, closeGate1) 

what is wrong?

Link to comment

I could see you've been using the wiki, here:OnVehicleStartEnter

try this:

local allowedGroups = { ["FBI"]=true } 
col1 = createColSphere ( 927.4365234375, -1022.5947265625, 35.913665771484, 27.5 ) 
gate1 = createObject (3113, 941.1669921875, -1012.3310546875, 32.369918823242, 0, 15, 272.5) 
  
function openGate1 ( player ) 
if ( allowedGroups[getElementData ( player, "FBI" )]  ) then 
    moveObject (gate1, 941.1669921875, -1012.3310546875, 21.369918823242, 0, 15, 272.5 ) 
   addEventHandler("onColShapeLeave", col1, closeGate1) -- add the event of leaving the colshape if it's an FBI 
end 
end 
addEventHandler("onColShapeHit", col1, openGate1) 
  
function closeGate1() 
moveObject(gate1, 3037, 941.1669921875, -1012.3310546875, 32.369918823242, 0, 15, 272.5) 
removeEventHandler("onColShapeLeave",col1,closeGate1) -- remove it after the gate is closed 
end 

Edited by Guest
Link to comment
what is wrong?
if ( allowedGroups  getElementData ( player, "FBI" )  ) then 

and

local allowedGroups = { "FBI"=true } 

Correct

local aAllowedGroups = 
{ 
    [ 'FBI' ] = true; 
    [ false ] = false; 
} 
  
local pCol = createColSphere ( 927.4365234375, -1022.5947265625, 35.913665771484, 27.5 ) 
local pGate = createObject ( 3113, 941.1669921875, -1012.3310546875, 32.369918823242, 0, 15, 272.5 ) 
  
function ColShapeManager( pElement ) 
    if  
        getElementType( pElement ) == 'player' and  
        aAllowedGroups[ getElementData ( pElement, 'FBI' ) ]  
    then 
        if eventName == 'onColShapeHit' then 
            moveObject ( pGate, 941.1669921875, -1012.3310546875, 21.369918823242, 0, 15, 272.5 ) 
        else 
            moveObject( pGate, 3037, 941.1669921875, -1012.3310546875, 32.369918823242, 0, 15, 272.5 ) 
        end 
    end 
end 
addEventHandler( 'onColShapeHit', pCol, ColShapeManager ) 
addEventHandler( 'onColShapeLeave', pCol, ColShapeManager ) 

What return data 'FBI' ?

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