Jump to content

Table issue


AJXB

Recommended Posts

local R = 255 --------------------------------- 
local G = 0    --This sets Radar Areas Color-- 
local B = 0   --------------------------------- 
local A = 125 -- Alpha 
  
    local turfs = 
    { 
        areas = 
        { 
            {918.95215, 1650.05286,65.546630859375,168.57604980469, R,G, B, A}; 
            {1877.18555, 642.92706, 100, 125, R,G, B, A}; 
            {1997.5, 683.15210, 140, 65, R,G, B, A}; 
            {2155, 643.28558, 122.5, 65, R,G, B, A}; 
            {2290, 640, 120, 70, R,G, B, A}; 
            {2515, 702, 160, 70, R,G, B, A}; 
            {1575, 660, 175, 125, R,G, B, A}; 
            {2775, 835,120,189.79992675781, R,G, B, A}; 
            {1017.66577, 1383.37659,159.2412109375,319.53955078125, R,G, B, A}; 
            {1295.58142, 2099.19238,135,123, R,G, B, A}; 
            {1577.30359, 2282.80029,179.78796386719,61.214599609375, R,G, B, A}; 
            {1628.58630, 2023.49329,68.798461914063,139.65148925781, R,255, B, A}; 
            {1837.53394, 2184.07544,78.707885742188,77.761474609375, R,G, B, A}; 
            {1993.63599, 2122.64014,113.74291992188,73.606201171875, R,G, B, A}; 
        }, 
        
        colshapes = 
        { 
            {1877.18555, 642.92706, 9.8, 100.05969238281, 120.13433837891, 13}; 
            {1997.5, 683.15210, 9.8, 140, 60, 13}; 
            {2157.44653, 643.28558, 9.8, 119.50463867188, 60.064758300781, 13}; 
            {2303.51489, 642.98639, 9.8, 113.763671875, 59.806884765625, 13}; 
            {2517.10059, 702.93488, 9.8, 160.19873046875, 60.3056640625, 13}; 
            {1577.50818, 663.07349, 9.8, 180.07995605469, 119.92926025391, 13}; 
            {2776.77539, 833.34174, 9.89844, 118.11865234375, 189.79992675781, 15}; 
            {1017.66577, 1383.37659, 5, 159.2412109375, 319.53955078125, 15}; 
            {918.95215, 1650.05286, 7.64844, 65.546630859375, 168.57604980469, 15}; 
            {1295.58142, 2099.19238, 9, 135, 123, 20}; 
            {1577.30359, 2282.80029, 9.75, 179.78796386719, 61.214599609375, 17}; 
            {1397.97644, 2323.18579, 10, 159.28210449219, 59.93896484375, 17}; 
            {1577.84595, 2182.70288, 10, 139.12902832031, 80.190185546875, 17}; 
            {1628.58630, 2023.49329, 9, 68.798461914063, 139.65148925781, 17}; 
        } 
    }; 
      
    for key, value in ipairs( turfs.areas ) do 
        area = createRadarArea( unpack( value ) ); 
    end 
      
    for key, value in ipairs( turfs.colshapes ) do 
        colshape = createColCuboid( unpack( value ) ); 
    end 
setElementData (colshape,"Owner","N/A") 
  
  
        -------- Turf 1 -------- 
    local pCubo  = colshape 
    local pRadar = area 
            addEventHandler("onColShapeHit", colshape, 
                          function( player ) 
                outputChatBox ("TEST") 
                    end 
                    ) 

i made this, problem is, onColShapeHit, the colshape source will take the last col values only, i mean, the "Basic test" output will only appear in {1628.58630, 2023.49329, 9, 68.798461914063, 139.65148925781, 17};

Any solution i want it to appear in all of the values ?

Link to comment

Add each colshape for a table.

local R = 255 --------------------------------- 
local G = 0    --This sets Radar Areas Color-- 
local B = 0   --------------------------------- 
local A = 125 -- Alpha 
  
local allAreas = {} 
local allColshapes = {} 
  
    local turfs = 
    { 
        areas = 
        { 
            {918.95215, 1650.05286,65.546630859375,168.57604980469, R,G, B, A}; 
            {1877.18555, 642.92706, 100, 125, R,G, B, A}; 
            {1997.5, 683.15210, 140, 65, R,G, B, A}; 
            {2155, 643.28558, 122.5, 65, R,G, B, A}; 
            {2290, 640, 120, 70, R,G, B, A}; 
            {2515, 702, 160, 70, R,G, B, A}; 
            {1575, 660, 175, 125, R,G, B, A}; 
            {2775, 835,120,189.79992675781, R,G, B, A}; 
            {1017.66577, 1383.37659,159.2412109375,319.53955078125, R,G, B, A}; 
            {1295.58142, 2099.19238,135,123, R,G, B, A}; 
            {1577.30359, 2282.80029,179.78796386719,61.214599609375, R,G, B, A}; 
            {1628.58630, 2023.49329,68.798461914063,139.65148925781, R,255, B, A}; 
            {1837.53394, 2184.07544,78.707885742188,77.761474609375, R,G, B, A}; 
            {1993.63599, 2122.64014,113.74291992188,73.606201171875, R,G, B, A}; 
        }, 
        
        colshapes = 
        { 
            {1877.18555, 642.92706, 9.8, 100.05969238281, 120.13433837891, 13}; 
            {1997.5, 683.15210, 9.8, 140, 60, 13}; 
            {2157.44653, 643.28558, 9.8, 119.50463867188, 60.064758300781, 13}; 
            {2303.51489, 642.98639, 9.8, 113.763671875, 59.806884765625, 13}; 
            {2517.10059, 702.93488, 9.8, 160.19873046875, 60.3056640625, 13}; 
            {1577.50818, 663.07349, 9.8, 180.07995605469, 119.92926025391, 13}; 
            {2776.77539, 833.34174, 9.89844, 118.11865234375, 189.79992675781, 15}; 
            {1017.66577, 1383.37659, 5, 159.2412109375, 319.53955078125, 15}; 
            {918.95215, 1650.05286, 7.64844, 65.546630859375, 168.57604980469, 15}; 
            {1295.58142, 2099.19238, 9, 135, 123, 20}; 
            {1577.30359, 2282.80029, 9.75, 179.78796386719, 61.214599609375, 17}; 
            {1397.97644, 2323.18579, 10, 159.28210449219, 59.93896484375, 17}; 
            {1577.84595, 2182.70288, 10, 139.12902832031, 80.190185546875, 17}; 
            {1628.58630, 2023.49329, 9, 68.798461914063, 139.65148925781, 17}; 
        } 
    }; 
      
    local aIndex = 0 
    local colIndex = 0 
     
    for key, value in ipairs( turfs.areas ) do 
        aIndex = aIndex+1 
        allAreas[aIndex] = createRadarArea( unpack( value ) ); 
    end 
      
    for key, value in ipairs( turfs.colshapes ) do 
        colIndex = colIndex+1 
        allColshapes[colIndex] = createColCuboid( unpack( value ) ); 
        setElementData(allColshapes[colIndex],"Owner","N/A") 
    end 
  
        -------- Turf 1 -------- 
    local pCubo  = colshape 
    local pRadar = area 
  
addEventHandler("onColShapeHit", root, 
    function( player ) 
        for i=1, #allColshapes do 
            if (source == allColshapes[i]) then 
                outputChatBox ("TEST") 
                break 
            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...