Jump to content

Need help with gates


darhal

Recommended Posts

hi all I made a script that open gates for SWATTeam group only but the gate dont open for me when i was in a vehicel

this code

server side only

col50  = createColTube(778.02728271484, -1325.1665039063, 13.546875, 10, 10) 
  
local gate50 = createObject(980,777.1341796875,-1329.7197265625,14.546875, 0, 0 , 178.50030517578 )   
  
  
function openGate50(player) 
    if (player and isElement(player) and getElementType(player)) == "player" then 
    local group = exports.UIPgroups:getPlayerGroup(player) 
        if (group and group == "SWATTeam" or exports.UIPteams:isPlayerInTeams(player, "Staff")) then 
            moveObject(gate50,1000,777.1845703125,-1329.7197265625,14.546875+6, 0, 0, 0 ) 
        end 
    end 
end   
addEventHandler("onColShapeHit", col50, openGate50) 
  
function closeGate50(player) 
    if (player and isElement(player) and getElementType(player)) == "player" then 
    local group = exports.UIPgroups:getPlayerGroup(player) 
        if (group and group == "SWATTeam" or exports.UIPteams:isPlayerInTeams(player, "Staff")) then 
            moveObject(gate50, 980,777.1845703125,-1329.7197265625,14.546875, 0, 0, 0)  
        end 
    end 
end 
addEventHandler("onColShapeLeave", col50, closeGate50) 
  
  
  

Link to comment

Try this:

col50  = createColTube(778.02728271484, -1325.1665039063, 13.546875, 10, 10) 
  
local gate50 = createObject(980,777.1341796875,-1329.7197265625,14.546875, 0, 0 , 178.50030517578 )   
  
  
function openGate50(hitElement) 
    if (hitElement and isElement(hitElement) then 
        if (getElementType(hitElement) == "vehicle") then 
            local player = getVehicleController(hitElement) 
        elseif (getElementType(hitElement) == "player") then 
            local player = hitElement 
        else 
            return 
        end 
        if (player) then 
            local group = exports.UIPgroups:getPlayerGroup(player) 
            if not group then return end 
            if (group == "SWATTeam" or exports.UIPteams:isPlayerInTeams(player, "Staff")) then 
                moveObject(gate50,1000,777.1845703125,-1329.7197265625,14.546875+6, 0, 0, 0 ) 
            end 
        end 
    end 
end   
addEventHandler("onColShapeHit", col50, openGate50) 
  
function closeGate50(hitElement) 
    if (hitElement and isElement(hitElement) then 
        if (getElementType(hitElement) == "vehicle") then 
            local player = getVehicleController(hitElement) 
        elseif (getElementType(hitElement) == "player") then 
            local player = hitElement 
        else 
            return 
        end 
        if (player) then 
            local group = exports.UIPgroups:getPlayerGroup(player) 
            if not group then return end 
            if (group == "SWATTeam" or exports.UIPteams:isPlayerInTeams(player, "Staff")) then 
                moveObject(gate50, 980,777.1845703125,-1329.7197265625,14.546875, 0, 0, 0) 
            end 
        end 
    end 
end 
addEventHandler("onColShapeLeave", col50, closeGate50) 

Link to comment
local col50  = createColTube(778.02728271484, -1325.1665039063, 13.546875, 10, 10) 
local gate50 = createObject(980,777.1341796875,-1329.7197265625,14.546875, 0, 0 , 178.50030517578 )   
  
  
function openGate50(thePlayer) 
    if (getElementType(thePlayert) == "player") then 
        local group = exports.UIPgroups:getPlayerGroup(thePlayer) 
        if (exports.UIPteams:isPlayerInTeams(thePlayer, "Staff")) or ((group) and (group == "SWATTeam")) then 
            moveObject(gate50,1000,777.1845703125,-1329.7197265625,14.546875+6, 0, 0, 0 ) 
        end 
    end 
end   
addEventHandler("onColShapeHit", col50, openGate50) 
  
function closeGate50(thePlayer) 
    if (getElementType(thePlayer) == "player") then 
        local group = exports.UIPgroups:getPlayerGroup(thePlayer) 
        if (exports.UIPteams:isPlayerInTeams(thePlayer, "Staff")) or ((group) and (group == "SWATTeam")) then 
            moveObject(gate50, 980,777.1845703125,-1329.7197265625,14.546875, 0, 0, 0) 
        end 
    end 
end 
addEventHandler("onColShapeLeave", col50, closeGate50) 

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