Jump to content

Safe zone


Recommended Posts

hello everyone, I have a safe zone, so I made a safe zone in the zone of Boss

we can not kill each other but the big problem is the boss can not damage us

so what do I need the Players cannot damage other players But the boss can, any one help me?

I try this but not work

if not getElementData(pHitElement,"boss") then

setElementData( pHitElement, 'damage', 'no' )

Thanks

Link to comment
  
local aSavePlaces =  
{ 
    Circle = 
    { 
        -- x, y, radius 
    }, 
    Cuboid = 
    { 
        -- x, y, z, Width, Depth, Height 
    }, 
    Rectangle = 
    { 
        -- X, Y, Width, Height 
        { 108.46, -1977.84, 85, 58 }, -- Hospitals + Spawn Base 
        { 1994.38, -1453.32, 110, 75 }, 
        { 1155.28, -1350.23, 65, 58 }, 
        { 1234.93, 302.44, 40, 58 }, 
        { 191.56, -83.96, 40, 58 }, 
        { 1589.75, 1800.18, 40, 58 }, 
        { -339.67, 1029.49, 40, 58 }, 
        { -1536.27, 2504.90, 40, 58 }, 
        { -2681.42, 582.40, 40, 58 }, 
        { -2224, -2326.97, 40, 58 }, 
        { 1560, -1137.41, 165, 158 }, -- Boss 
        { 2372.29, 1823.58, 135, 158 }, 
        { -2145.80, 118.67, 158, 200 }, 
        { 436.91, 767.93, 450, 280 }, -- Trabajos 
        { -413.28, -1570.95, 270, 328 }, 
    }, 
    Sphere = 
    { 
        -- X, Y, Z, Radius 
    }, 
    Tube =  
    { 
        -- X, Y, Z, Radius, Height 
    }, 
    Polygon = 
    { 
        -- X, Y, X1, Y1, X2, Y2, X3, Y3, ... 
        -- You can add like X4, Y4 .. 
    } 
} 
  
local aRadarAreaPlaces =  
{ 
  
    { 108.46, -1977.84, 85, 58, 0, 255, 0, 0 }, -- Hospitals + Spawn Base 
    { 1994.38, -1453.32, 110, 75, 0, 255, 0, 0 }, 
    { 1155.28, -1350.23, 65, 58, 0, 255, 0, 0 }, 
    { 1234.93, 302.44, 40, 58, 0, 255, 0, 0 }, 
    { 191.56, -83.96, 40, 58, 0, 255, 0, 0 }, 
    { 1589.75, 1800.18, 40, 58, 0, 255, 0, 0 }, 
    { -339.67, 1029.49, 40, 58, 0, 255, 0, 0 }, 
    { -1536.27, 2504.90, 40, 58, 0, 255, 0, 0 }, 
    { -2681.42, 582.40, 40, 58, 0, 255, 0, 0 }, 
        { -2224, -2326.97, 40, 58, 0, 255, 0, 0 }, 
    { 1560, -1137.41, 165, 158, 0, 255, 0, 0 }, -- Boss 
    { 2372.29, 1823.58, 135, 158, 0, 255, 0, 0 }, 
    { -2145.80, 118.67, 158, 200, 0, 255, 0, 0 }, 
    { 436.91, 767.93, 450, 280, 0, 255, 0, 0 }, -- Trabajos 
    { -413.28, -1570.95, 270, 328, 0, 255, 0, 0 }, 
} 
  
local sResourceName             = getResourceName ( resource ) 
local bUseGunsInSavePlace       = get( sResourceName .. '.UseGunsInSaveZone' ) 
local bUseRadarArea             = get( sResourceName .. '.UseRadarArea' ) 
local pColshape, pRadarArea 
  
local bUseRunInSaveZone         = get( sResourceName .. '.UseRunInSaveZone' ) 
local bUseJumpInSaveZone        = get( sResourceName .. '.UseJumpInSaveZone' ) 
local bUseWeaponHudInSaveZone   = get( sResourceName .. '.UseWeaponHudInSaveZone' ) 
local bUseAmmoHudInSaveZone     = get( sResourceName .. '.UseAmmoHudInSaveZone' ) 
  
local bUseDamageInSaveZone      = get( sResourceName .. '.UseDamageInSaveZone' ) 
  
addEventHandler ( 'onResourceStart', resourceRoot,  
    function ( ) 
        local display = textCreateDisplay () 
        local text = textCreateTextItem("Estas en Zona Segura !", 0.9, 0.7, "high", 0, 255, 0, 255, 2, "right", "bottom") 
        textDisplayAddText(display, text)  
        for s, _ in pairs( aSavePlaces ) do 
            for _, a in pairs( aSavePlaces[ s ] ) do 
                pColshape = _G[ 'createCol' .. s ]( unpack( a ) ) 
                --setElementData( pColshape, 'zombieProof', true ) 
                addEventHandler ( 'onColShapeHit', pColshape,  
                    function ( pHitElement ) 
                        if getElementType( pHitElement ) == 'player' then 
                            textDisplayAddObserver(display, pHitElement) 
                            if not bUseGunsInSavePlace then 
                            end 
                            if not bUseDamageInSaveZone then 
                                setElementData( pHitElement, 'damage', 'no' ) 
                            end  
                        elseif getElementType( pHitElement ) == 'ped' then -- check if the entered ped kill it   
                            if getElementData(pHitElement, "zombie") then 
                                killPed(pHitElement) 
                            end 
                        end  
                    end 
                )    
                addEventHandler ( 'onColShapeLeave', pColshape,  
                    function ( pLeaveElement ) 
                        if getElementType( pLeaveElement ) == 'player' then 
                            textDisplayRemoveObserver(display, pLeaveElement) 
                            if not bUseGunsInSavePlace then 
                            end 
                            if not bUseDamageInSaveZone then 
                                setElementData( pLeaveElement, 'damage', 'yes' ) 
                            end 
                        elseif getElementType( pLeaveElement ) == 'ped' then -- check if the entered ped kill it 
                        end 
                    end 
                ) 
            end 
        end 
        if bUseRadarArea then 
            for _, a in ipairs( aRadarAreaPlaces ) do 
                pRadarArea = createRadarArea ( unpack( a ) ) 
                setElementData( pRadarArea, 'zombieProof', true ) 
            end 
        end 
    end     
)  

Link to comment

I gave you a working code.

But you removed the changes I put.

      
    local aSavePlaces = 
    { 
        Circle = 
        { 
            -- x, y, radius 
        }, 
        Cuboid = 
        { 
            -- x, y, z, Width, Depth, Height 
        }, 
        Rectangle = 
        { 
            -- X, Y, Width, Height 
            { 108.46, -1977.84, 85, 58 }, -- Hospitals + Spawn Base 
            { 1994.38, -1453.32, 110, 75 }, 
            { 1155.28, -1350.23, 65, 58 }, 
            { 1234.93, 302.44, 40, 58 }, 
            { 191.56, -83.96, 40, 58 }, 
            { 1589.75, 1800.18, 40, 58 }, 
            { -339.67, 1029.49, 40, 58 }, 
            { -1536.27, 2504.90, 40, 58 }, 
            { -2681.42, 582.40, 40, 58 }, 
            { -2224, -2326.97, 40, 58 }, 
            { 1560, -1137.41, 165, 158 }, -- Boss 
            { 2372.29, 1823.58, 135, 158 }, 
            { -2145.80, 118.67, 158, 200 }, 
            { 436.91, 767.93, 450, 280 }, -- Trabajos 
            { -413.28, -1570.95, 270, 328 }, 
        }, 
        Sphere = 
        { 
            -- X, Y, Z, Radius 
        }, 
        Tube = 
        { 
            -- X, Y, Z, Radius, Height 
        }, 
        Polygon = 
        { 
            -- X, Y, X1, Y1, X2, Y2, X3, Y3, ... 
            -- You can add like X4, Y4 .. 
        } 
    } 
      
    local aRadarAreaPlaces = 
    { 
      
        { 108.46, -1977.84, 85, 58, 0, 255, 0, 0 }, -- Hospitals + Spawn Base 
        { 1994.38, -1453.32, 110, 75, 0, 255, 0, 0 }, 
        { 1155.28, -1350.23, 65, 58, 0, 255, 0, 0 }, 
        { 1234.93, 302.44, 40, 58, 0, 255, 0, 0 }, 
        { 191.56, -83.96, 40, 58, 0, 255, 0, 0 }, 
        { 1589.75, 1800.18, 40, 58, 0, 255, 0, 0 }, 
        { -339.67, 1029.49, 40, 58, 0, 255, 0, 0 }, 
        { -1536.27, 2504.90, 40, 58, 0, 255, 0, 0 }, 
        { -2681.42, 582.40, 40, 58, 0, 255, 0, 0 }, 
            { -2224, -2326.97, 40, 58, 0, 255, 0, 0 }, 
        { 1560, -1137.41, 165, 158, 0, 255, 0, 0 }, -- Boss 
        { 2372.29, 1823.58, 135, 158, 0, 255, 0, 0 }, 
        { -2145.80, 118.67, 158, 200, 0, 255, 0, 0 }, 
        { 436.91, 767.93, 450, 280, 0, 255, 0, 0 }, -- Trabajos 
        { -413.28, -1570.95, 270, 328, 0, 255, 0, 0 }, 
    } 
      
    local sResourceName             = getResourceName ( resource ) 
    local bUseGunsInSavePlace       = get( sResourceName .. '.UseGunsInSaveZone' ) 
    local bUseRadarArea             = get( sResourceName .. '.UseRadarArea' ) 
    local pColshape, pRadarArea 
      
    local bUseRunInSaveZone         = get( sResourceName .. '.UseRunInSaveZone' ) 
    local bUseJumpInSaveZone        = get( sResourceName .. '.UseJumpInSaveZone' ) 
    local bUseWeaponHudInSaveZone   = get( sResourceName .. '.UseWeaponHudInSaveZone' ) 
    local bUseAmmoHudInSaveZone     = get( sResourceName .. '.UseAmmoHudInSaveZone' ) 
      
    local bUseDamageInSaveZone      = get( sResourceName .. '.UseDamageInSaveZone' ) 
      
    addEventHandler ( 'onResourceStart', resourceRoot, 
        function ( ) 
            local display = textCreateDisplay () 
            local text = textCreateTextItem("Estas en Zona Segura !", 0.9, 0.7, "high", 0, 255, 0, 255, 2, "right", "bottom") 
            textDisplayAddText(display, text) 
            for s, _ in pairs( aSavePlaces ) do 
                for _, a in pairs( aSavePlaces[ s ] ) do 
                    pColshape = _G[ 'createCol' .. s ]( unpack( a ) ) 
                    --setElementData( pColshape, 'zombieProof', true ) 
                    addEventHandler ( 'onColShapeHit', pColshape, 
                        function ( pHitElement ) 
                            if getElementType( pHitElement ) == 'player' then 
                                   if not getElementData(pHitElement,"boss") then 
                                textDisplayAddObserver(display, pHitElement) 
                                if not bUseGunsInSavePlace then 
                                end 
                                if not bUseDamageInSaveZone then 
                                    setElementData( pHitElement, 'damage', 'no' ) 
                                end  
                           end 
                            elseif getElementType( pHitElement ) == 'ped' then -- check if the entered ped kill it   
                                if getElementData(pHitElement, "zombie") then 
                                    killPed(pHitElement) 
                                end 
                            end 
                        end 
                    )   
                    addEventHandler ( 'onColShapeLeave', pColshape, 
                        function ( pLeaveElement ) 
                            if getElementType( pLeaveElement ) == 'player' then 
                                textDisplayRemoveObserver(display, pLeaveElement) 
                                if not bUseGunsInSavePlace then 
                                end 
                                if not bUseDamageInSaveZone then 
                                    setElementData( pLeaveElement, 'damage', 'yes' ) 
                                end 
                            elseif getElementType( pLeaveElement ) == 'ped' then -- check if the entered ped kill it 
                            end 
                        end 
                    ) 
                end 
            end 
            if bUseRadarArea then 
                for _, a in ipairs( aRadarAreaPlaces ) do 
                    pRadarArea = createRadarArea ( unpack( a ) ) 
                    setElementData( pRadarArea, 'zombieProof', true ) 
                end 
            end 
        end     
    )  

setElementData(BossElement,"boss",true) 

-- To assign a boss.

Link to comment

And here's an update for this code.

         
   
        local aSavePlaces = 
        { 
            Circle = 
            { 
                -- x, y, radius 
            }, 
            Cuboid = 
            { 
                -- x, y, z, Width, Depth, Height 
            }, 
            Rectangle = 
            { 
                -- X, Y, Width, Height 
                { 108.46, -1977.84, 85, 58 }, -- Hospitals + Spawn Base 
                { 1994.38, -1453.32, 110, 75 }, 
                { 1155.28, -1350.23, 65, 58 }, 
                { 1234.93, 302.44, 40, 58 }, 
                { 191.56, -83.96, 40, 58 }, 
                { 1589.75, 1800.18, 40, 58 }, 
                { -339.67, 1029.49, 40, 58 }, 
                { -1536.27, 2504.90, 40, 58 }, 
                { -2681.42, 582.40, 40, 58 }, 
                { -2224, -2326.97, 40, 58 }, 
                { 1560, -1137.41, 165, 158 }, -- Boss 
                { 2372.29, 1823.58, 135, 158 }, 
                { -2145.80, 118.67, 158, 200 }, 
                { 436.91, 767.93, 450, 280 }, -- Trabajos 
                { -413.28, -1570.95, 270, 328 }, 
            }, 
            Sphere = 
            { 
                -- X, Y, Z, Radius 
            }, 
            Tube = 
            { 
                -- X, Y, Z, Radius, Height 
            }, 
            Polygon = 
            { 
                -- X, Y, X1, Y1, X2, Y2, X3, Y3, ... 
                -- You can add like X4, Y4 .. 
            } 
        } 
          
        local aRadarAreaPlaces = 
        { 
          
            { 108.46, -1977.84, 85, 58, 0, 255, 0, 0 }, -- Hospitals + Spawn Base 
            { 1994.38, -1453.32, 110, 75, 0, 255, 0, 0 }, 
            { 1155.28, -1350.23, 65, 58, 0, 255, 0, 0 }, 
            { 1234.93, 302.44, 40, 58, 0, 255, 0, 0 }, 
            { 191.56, -83.96, 40, 58, 0, 255, 0, 0 }, 
            { 1589.75, 1800.18, 40, 58, 0, 255, 0, 0 }, 
            { -339.67, 1029.49, 40, 58, 0, 255, 0, 0 }, 
            { -1536.27, 2504.90, 40, 58, 0, 255, 0, 0 }, 
            { -2681.42, 582.40, 40, 58, 0, 255, 0, 0 }, 
                { -2224, -2326.97, 40, 58, 0, 255, 0, 0 }, 
            { 1560, -1137.41, 165, 158, 0, 255, 0, 0 }, -- Boss 
            { 2372.29, 1823.58, 135, 158, 0, 255, 0, 0 }, 
            { -2145.80, 118.67, 158, 200, 0, 255, 0, 0 }, 
            { 436.91, 767.93, 450, 280, 0, 255, 0, 0 }, -- Trabajos 
            { -413.28, -1570.95, 270, 328, 0, 255, 0, 0 }, 
        } 
          
        local sResourceName             = getResourceName ( resource ) 
        local bUseGunsInSavePlace       = get( sResourceName .. '.UseGunsInSaveZone' ) 
        local bUseRadarArea             = get( sResourceName .. '.UseRadarArea' ) 
        local pColshape, pRadarArea 
          
        local bUseRunInSaveZone         = get( sResourceName .. '.UseRunInSaveZone' ) 
        local bUseJumpInSaveZone        = get( sResourceName .. '.UseJumpInSaveZone' ) 
        local bUseWeaponHudInSaveZone   = get( sResourceName .. '.UseWeaponHudInSaveZone' ) 
        local bUseAmmoHudInSaveZone     = get( sResourceName .. '.UseAmmoHudInSaveZone' ) 
          
        local bUseDamageInSaveZone      = get( sResourceName .. '.UseDamageInSaveZone' ) 
          
        addEventHandler ( 'onResourceStart', resourceRoot, 
            function ( ) 
                local display = textCreateDisplay () 
                local text = textCreateTextItem("Estas en Zona Segura !", 0.9, 0.7, "high", 0, 255, 0, 255, 2, "right", "bottom") 
                textDisplayAddText(display, text) 
                for s, _ in pairs( aSavePlaces ) do 
                    for _, a in pairs( aSavePlaces[ s ] ) do 
                        pColshape = _G[ 'createCol' .. s ]( unpack( a ) ) 
                        --setElementData( pColshape, 'zombieProof', true ) 
                        addEventHandler ( 'onColShapeHit', pColshape, 
                            function ( pHitElement ) 
                                if getElementType( pHitElement ) == 'player' then 
                                    textDisplayAddObserver(display, pHitElement) 
                                    if not bUseGunsInSavePlace then 
                                    end 
                                    if not bUseDamageInSaveZone then 
                                        setElementData( pHitElement, 'damage', 'no' ) 
                                    end 
                                elseif getElementType( pHitElement ) == 'ped' then -- check if the entered ped kill it   
                                    if getElementData(pHitElement, "zombie") then 
                                    if not getElementData(pHitElement,"boss") then 
                                        killPed(pHitElement) 
                                    end 
                                end 
                            end 
                        )   
                        addEventHandler ( 'onColShapeLeave', pColshape, 
                            function ( pLeaveElement ) 
                                if getElementType( pLeaveElement ) == 'player' then 
                                    textDisplayRemoveObserver(display, pLeaveElement) 
                                    if not bUseGunsInSavePlace then 
                                    end 
                                    if not bUseDamageInSaveZone then 
                                        setElementData( pLeaveElement, 'damage', 'yes' ) 
                                    end 
                                elseif getElementType( pLeaveElement ) == 'ped' then -- check if the entered ped kill it 
                                end 
                            end 
                        ) 
                    end 
                end 
                if bUseRadarArea then 
                    for _, a in ipairs( aRadarAreaPlaces ) do 
                        pRadarArea = createRadarArea ( unpack( a ) ) 
                        setElementData( pRadarArea, 'zombieProof', true ) 
                    end 
                end 
            end     
        ) 

Link to comment
             
      
            local aSavePlaces = 
            { 
                Circle = 
                { 
                    -- x, y, radius 
                }, 
                Cuboid = 
                { 
                    -- x, y, z, Width, Depth, Height 
                }, 
                Rectangle = 
                { 
                    -- X, Y, Width, Height 
                    { 108.46, -1977.84, 85, 58 }, -- Hospitals + Spawn Base 
                    { 1994.38, -1453.32, 110, 75 }, 
                    { 1155.28, -1350.23, 65, 58 }, 
                    { 1234.93, 302.44, 40, 58 }, 
                    { 191.56, -83.96, 40, 58 }, 
                    { 1589.75, 1800.18, 40, 58 }, 
                    { -339.67, 1029.49, 40, 58 }, 
                    { -1536.27, 2504.90, 40, 58 }, 
                    { -2681.42, 582.40, 40, 58 }, 
                    { -2224, -2326.97, 40, 58 }, 
                    { 1560, -1137.41, 165, 158 }, -- Boss 
                    { 2372.29, 1823.58, 135, 158 }, 
                    { -2145.80, 118.67, 158, 200 }, 
                    { 436.91, 767.93, 450, 280 }, -- Trabajos 
                    { -413.28, -1570.95, 270, 328 }, 
                }, 
                Sphere = 
                { 
                    -- X, Y, Z, Radius 
                }, 
                Tube = 
                { 
                    -- X, Y, Z, Radius, Height 
                }, 
                Polygon = 
                { 
                    -- X, Y, X1, Y1, X2, Y2, X3, Y3, ... 
                    -- You can add like X4, Y4 .. 
                } 
            } 
              
            local aRadarAreaPlaces = 
            { 
              
                { 108.46, -1977.84, 85, 58, 0, 255, 0, 0 }, -- Hospitals + Spawn Base 
                { 1994.38, -1453.32, 110, 75, 0, 255, 0, 0 }, 
                { 1155.28, -1350.23, 65, 58, 0, 255, 0, 0 }, 
                { 1234.93, 302.44, 40, 58, 0, 255, 0, 0 }, 
                { 191.56, -83.96, 40, 58, 0, 255, 0, 0 }, 
                { 1589.75, 1800.18, 40, 58, 0, 255, 0, 0 }, 
                { -339.67, 1029.49, 40, 58, 0, 255, 0, 0 }, 
                { -1536.27, 2504.90, 40, 58, 0, 255, 0, 0 }, 
                { -2681.42, 582.40, 40, 58, 0, 255, 0, 0 }, 
                    { -2224, -2326.97, 40, 58, 0, 255, 0, 0 }, 
                { 1560, -1137.41, 165, 158, 0, 255, 0, 0 }, -- Boss 
                { 2372.29, 1823.58, 135, 158, 0, 255, 0, 0 }, 
                { -2145.80, 118.67, 158, 200, 0, 255, 0, 0 }, 
                { 436.91, 767.93, 450, 280, 0, 255, 0, 0 }, -- Trabajos 
                { -413.28, -1570.95, 270, 328, 0, 255, 0, 0 }, 
            } 
              
            local sResourceName             = getResourceName ( resource ) 
            local bUseGunsInSavePlace       = get( sResourceName .. '.UseGunsInSaveZone' ) 
            local bUseRadarArea             = get( sResourceName .. '.UseRadarArea' ) 
            local pColshape, pRadarArea 
              
            local bUseRunInSaveZone         = get( sResourceName .. '.UseRunInSaveZone' ) 
            local bUseJumpInSaveZone        = get( sResourceName .. '.UseJumpInSaveZone' ) 
            local bUseWeaponHudInSaveZone   = get( sResourceName .. '.UseWeaponHudInSaveZone' ) 
            local bUseAmmoHudInSaveZone     = get( sResourceName .. '.UseAmmoHudInSaveZone' ) 
              
            local bUseDamageInSaveZone      = get( sResourceName .. '.UseDamageInSaveZone' ) 
              
            addEventHandler ( 'onResourceStart', resourceRoot, 
                function ( ) 
                    local display = textCreateDisplay () 
                    local text = textCreateTextItem("Estas en Zona Segura !", 0.9, 0.7, "high", 0, 255, 0, 255, 2, "right", "bottom") 
                    textDisplayAddText(display, text) 
                    for s, _ in pairs( aSavePlaces ) do 
                        for _, a in pairs( aSavePlaces[ s ] ) do 
                            pColshape = _G[ 'createCol' .. s ]( unpack( a ) ) 
                            --setElementData( pColshape, 'zombieProof', true ) 
                             
                            addEventHandler ( 'onColShapeHit', pColshape, 
                                function ( pHitElement ) 
                                    if getElementType( pHitElement ) == 'player' then 
                                        textDisplayAddObserver(display, pHitElement) 
                                        if not bUseGunsInSavePlace then 
                                        end 
                                        if not bUseDamageInSaveZone then 
                                            setElementData( pHitElement, 'damage', 'no' ) 
                                        end 
                                    elseif getElementType( pHitElement ) == 'ped' then -- check if the entered ped kill it   
                                        if getElementData(pHitElement, "zombie") then 
                                        if not getElementData(pHitElement,"boss") then 
                                            killPed(pHitElement) 
                                        end 
                                    end 
                                end 
                             end 
                            )   
  
                            addEventHandler ( 'onColShapeLeave', pColshape, 
                                function ( pLeaveElement ) 
                                    if getElementType( pLeaveElement ) == 'player' then 
                                        textDisplayRemoveObserver(display, pLeaveElement) 
                                        if not bUseGunsInSavePlace then 
                                        end 
                                        if not bUseDamageInSaveZone then 
                                            setElementData( pLeaveElement, 'damage', 'yes' ) 
                                        end 
                                    elseif getElementType( pLeaveElement ) == 'ped' then -- check if the entered ped kill it 
                                    end 
                                end 
                            ) 
                        end 
                    end 
                    if bUseRadarArea then 
                        for _, a in ipairs( aRadarAreaPlaces ) do 
                            pRadarArea = createRadarArea ( unpack( a ) ) 
                            setElementData( pRadarArea, 'zombieProof', true ) 
                        end 
                    end 
                end     
            ) 

Link to comment
             
      
            local aSavePlaces = 
            { 
                Circle = 
                { 
                    -- x, y, radius 
                }, 
                Cuboid = 
                { 
                    -- x, y, z, Width, Depth, Height 
                }, 
                Rectangle = 
                { 
                    -- X, Y, Width, Height 
                    { 108.46, -1977.84, 85, 58 }, -- Hospitals + Spawn Base 
                    { 1994.38, -1453.32, 110, 75 }, 
                    { 1155.28, -1350.23, 65, 58 }, 
                    { 1234.93, 302.44, 40, 58 }, 
                    { 191.56, -83.96, 40, 58 }, 
                    { 1589.75, 1800.18, 40, 58 }, 
                    { -339.67, 1029.49, 40, 58 }, 
                    { -1536.27, 2504.90, 40, 58 }, 
                    { -2681.42, 582.40, 40, 58 }, 
                    { -2224, -2326.97, 40, 58 }, 
                    { 1560, -1137.41, 165, 158 }, -- Boss 
                    { 2372.29, 1823.58, 135, 158 }, 
                    { -2145.80, 118.67, 158, 200 }, 
                    { 436.91, 767.93, 450, 280 }, -- Trabajos 
                    { -413.28, -1570.95, 270, 328 }, 
                }, 
                Sphere = 
                { 
                    -- X, Y, Z, Radius 
                }, 
                Tube = 
                { 
                    -- X, Y, Z, Radius, Height 
                }, 
                Polygon = 
                { 
                    -- X, Y, X1, Y1, X2, Y2, X3, Y3, ... 
                    -- You can add like X4, Y4 .. 
                } 
            } 
              
            local aRadarAreaPlaces = 
            { 
              
                { 108.46, -1977.84, 85, 58, 0, 255, 0, 0 }, -- Hospitals + Spawn Base 
                { 1994.38, -1453.32, 110, 75, 0, 255, 0, 0 }, 
                { 1155.28, -1350.23, 65, 58, 0, 255, 0, 0 }, 
                { 1234.93, 302.44, 40, 58, 0, 255, 0, 0 }, 
                { 191.56, -83.96, 40, 58, 0, 255, 0, 0 }, 
                { 1589.75, 1800.18, 40, 58, 0, 255, 0, 0 }, 
                { -339.67, 1029.49, 40, 58, 0, 255, 0, 0 }, 
                { -1536.27, 2504.90, 40, 58, 0, 255, 0, 0 }, 
                { -2681.42, 582.40, 40, 58, 0, 255, 0, 0 }, 
                    { -2224, -2326.97, 40, 58, 0, 255, 0, 0 }, 
                { 1560, -1137.41, 165, 158, 0, 255, 0, 0 }, -- Boss 
                { 2372.29, 1823.58, 135, 158, 0, 255, 0, 0 }, 
                { -2145.80, 118.67, 158, 200, 0, 255, 0, 0 }, 
                { 436.91, 767.93, 450, 280, 0, 255, 0, 0 }, -- Trabajos 
                { -413.28, -1570.95, 270, 328, 0, 255, 0, 0 }, 
            } 
              
            local sResourceName             = getResourceName ( resource ) 
            local bUseGunsInSavePlace       = get( sResourceName .. '.UseGunsInSaveZone' ) 
            local bUseRadarArea             = get( sResourceName .. '.UseRadarArea' ) 
            local pColshape, pRadarArea 
              
            local bUseRunInSaveZone         = get( sResourceName .. '.UseRunInSaveZone' ) 
            local bUseJumpInSaveZone        = get( sResourceName .. '.UseJumpInSaveZone' ) 
            local bUseWeaponHudInSaveZone   = get( sResourceName .. '.UseWeaponHudInSaveZone' ) 
            local bUseAmmoHudInSaveZone     = get( sResourceName .. '.UseAmmoHudInSaveZone' ) 
              
            local bUseDamageInSaveZone      = get( sResourceName .. '.UseDamageInSaveZone' ) 
              
            addEventHandler ( 'onResourceStart', resourceRoot, 
                function ( ) 
                    local display = textCreateDisplay () 
                    local text = textCreateTextItem("Estas en Zona Segura !", 0.9, 0.7, "high", 0, 255, 0, 255, 2, "right", "bottom") 
                    textDisplayAddText(display, text) 
                    for s, _ in pairs( aSavePlaces ) do 
                        for _, a in pairs( aSavePlaces[ s ] ) do 
                            pColshape = _G[ 'createCol' .. s ]( unpack( a ) ) 
                            --setElementData( pColshape, 'zombieProof', true ) 
                             
                            addEventHandler ( 'onColShapeHit', pColshape, 
                                function ( pHitElement ) 
                                    if getElementType( pHitElement ) == 'player' then 
                                        textDisplayAddObserver(display, pHitElement) 
                                        if not bUseGunsInSavePlace then 
                                        end 
                                        if not bUseDamageInSaveZone then 
                                            setElementData( pHitElement, 'damage', 'no' ) 
                                        end 
                                    elseif getElementType( pHitElement ) == 'ped' then -- check if the entered ped kill it   
                                        if getElementData(pHitElement, "zombie") then 
                                        if getElementData(pHitElement,"boss") ~= false then 
                                            killPed(pHitElement) 
                                        end 
                                    end-- 
                                end-- 
                             end-- 
                            )   
  
                            addEventHandler ( 'onColShapeLeave', pColshape, 
                                function ( pLeaveElement ) 
                                    if getElementType( pLeaveElement ) == 'player' then 
                                        textDisplayRemoveObserver(display, pLeaveElement) 
                                        if not bUseGunsInSavePlace then 
                                        end 
                                        if not bUseDamageInSaveZone then 
                                            setElementData( pLeaveElement, 'damage', 'yes' ) 
                                        end 
                                    elseif getElementType( pLeaveElement ) == 'ped' then -- check if the entered ped kill it 
                                    end 
                                end 
                            ) 
                        end 
                    end 
                    if bUseRadarArea then 
                        for _, a in ipairs( aRadarAreaPlaces ) do 
                            pRadarArea = createRadarArea ( unpack( a ) ) 
                            setElementData( pRadarArea, 'zombieProof', true ) 
                        end 
                    end 
                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...