Jump to content

[Help] area name


Death

Recommended Posts

Posted

this is my code but does not work

  
 local areas = { 
    ['Last Dime Motel'] = { x = '1876.0206298828',  y = '639.92822265625', z = '0', width = '110', height = '120', size= '155' };        
    ['Come-A-Lot'] = { x = '2088.8642578125',  y = '983.38934326172', z = '0', width = '250', height = '195', size= '155' }; 
    ['Redsands West'] = { x = '1297.0888671875',  y = '2101.5236816406', z = '0', width = '100', height = '100', size= '155' }; 
    ['Roca Escalante'] = { x = '2294.7055664063',  y = '2242.7463378906', z = '0', width = '320', height = '200', size= '155' }; 
    ['Pilgrim'] = { x = '2439.5773925781',  y = '1484.2821044922', z = '0', width = '170', height = '120', size= '155' }; 
    ['LVA Freight Depot'] = { x = '1576.5826416016',  y = '883.79443359375', z = '0', width = '180', height = '250', size= '155' }; 
    ['Las Venturas Airport'] = { x = '1256.7247314453',  y = '1211.0180664063', z = '0', width = '360', height = '450', size= '155' }; 
    ['t'] = { x = '1121.9184570313',  y = '2723.6286621094', z = '0', width = '410', height = '130', size= '155' }; 
    ['El Quebrados'] = { x = '-1624.2315673828',  y = '2546.4689941406', z = '0', width = '200', height = '160', size= '155' }; 
    ['Ocean Flats'] = { x = '-2800.4970703125',  y = '-203.62327575684', z = '0', width = '200', height = '460', size= '155' }; 
    ['Hashbury'] = { x = '-2586.9035644531',  y = '-207.01741027832', z = '0', width = '160', height = '250', size= '155' }; 
    ['Garcia'] = { x = '-2410.7312011719',  y = '-201.14291381836', z = '0', width = '200', height = '460', size= '155' }; 
    ['Doherty'] = { x = '-2166.2292480469',  y = '-63.644058227539', z = '0', width = '160', height = '310', size= '155' }; 
    ["King's"] = { x = '-2155.6318359375',  y = '329.27984619141', z = '0', width = '160', height = '240', size= '155' }; 
    ['Calton Heights'] = { x = '-2248.1584472656',  y = '748.20239257813', z = '0', width = '238', height = '530', size= '155' }; 
    ['City Hall'] = { x = '-2812.9992675781',  y = '296.84313964844', z = '0', width = '200', height = '160', size= '155' }; 
    ['Santa flora'] = { x = '-2738.5361328125',  y = '478.66021728516', z = '0', width = '200', height = '320', size= '155' }; 
    ['Financial'] = { x = '-1870.4908447266',  y = '848.87469482422', z = '0', width = '152', height = '320', size= '155' }; 
    ['Ganton'] = { x = '2226.7885742188',  y = '-1835.9097900391', z = '0', width = '320', height = '200', size= '155' }; 
    ['Willowfield'] = { x = '1977.2436523438',  y = '-2145.0498046875', z = '0', width = '560', height = '280', size= '155' }; 
    ['Idlewood'] = { x = '1824.6007080078',  y = '-1837.0328369141', z = '0', width = '400', height = '280', size= '155' }; 
    ['Los Flores'] = { x = '2583.2983398438',  y = '-1389.1251220703', z = '0', width = '140', height = '250', size= '155' }; 
    ['Glen Park'] = { x = '1840.0902099609',  y = '-1447.9831542969', z = '0', width = '140', height = '120', size= '155' }; 
    ['East Los Santos'] = { x = '2274.6704101563',  y = '-1549.1168212891', z = '0', width = '300', height = '390', size= '155' }; 
    ['Marina'] = { x = '668.58984375', y = '-1734.75390625', z = '0', width = '90', height = '270', size = '155' }; 
    ['Los Santos International'] = { x = '2056.7900390625', y = '-2412.576171875', z = '0', width = '100', height = '100', size = '155' }; 
    ['The High Roller'] = { x = '1837.7880859375', y = '1283.57421875', z = '0', width = '200', height = '150', size = '155' }; 
} 
  
local theArea = { } 
function disableGTAZones() 
setPlayerHudComponentVisible(source, "area_name", false) 
end 
addEventHandler("onPlayerJoin", root, disableGTAZones) 
  
function createNewZones() 
for _, area in pairs ( areas ) do 
    theArea[_] = createColCuboid ( area.x, area.y, area.z, area.width, area.height, area.size ); 
    outputChatBox("".._.."") 
    setElementData(theArea[_], "zone_name", _) 
    addEventHandler ( 'onColShapeHit', theArea[_], printNewZoneName ); 
     
end 
end 
addEventHandler("onResourceStart", root, createNewZones) 
  
function printNewZoneName(theZone) 
if getElementType(source) == "player" then 
outputChatBox("Puto", source) 
outputChatBox(getElementData(theZone, "zone_name").." zone entered!", source, 255, 0, 0) 
end 
end 
  
  

Posted

You are using the wrong arguments.

'source' is the colshape you hit, not the element who hit it, and 'theZone' in this case, is the element that hit it.

Posted

I enter every zone and zone-name displays only the result Garcia

My current script

  
  
 local areas = { 
    ['Last Dime Motel'] = { x = '1876.0206298828',  y = '639.92822265625', z = '0', width = '110', height = '120', size= '155' };        
    ['Come-A-Lot'] = { x = '2088.8642578125',  y = '983.38934326172', z = '0', width = '250', height = '195', size= '155' }; 
    ['Redsands West'] = { x = '1297.0888671875',  y = '2101.5236816406', z = '0', width = '100', height = '100', size= '155' }; 
    ['Roca Escalante'] = { x = '2294.7055664063',  y = '2242.7463378906', z = '0', width = '320', height = '200', size= '155' }; 
    ['Pilgrim'] = { x = '2439.5773925781',  y = '1484.2821044922', z = '0', width = '170', height = '120', size= '155' }; 
    ['LVA Freight Depot'] = { x = '1576.5826416016',  y = '883.79443359375', z = '0', width = '180', height = '250', size= '155' }; 
    ['Las Venturas Airport'] = { x = '1256.7247314453',  y = '1211.0180664063', z = '0', width = '360', height = '450', size= '155' }; 
    ['t'] = { x = '1121.9184570313',  y = '2723.6286621094', z = '0', width = '410', height = '130', size= '155' }; 
    ['El Quebrados'] = { x = '-1624.2315673828',  y = '2546.4689941406', z = '0', width = '200', height = '160', size= '155' }; 
    ['Ocean Flats'] = { x = '-2800.4970703125',  y = '-203.62327575684', z = '0', width = '200', height = '460', size= '155' }; 
    ['Hashbury'] = { x = '-2586.9035644531',  y = '-207.01741027832', z = '0', width = '160', height = '250', size= '155' }; 
    ['Garcia'] = { x = '-2410.7312011719',  y = '-201.14291381836', z = '0', width = '200', height = '460', size= '155' }; 
    ['Doherty'] = { x = '-2166.2292480469',  y = '-63.644058227539', z = '0', width = '160', height = '310', size= '155' }; 
    ["King's"] = { x = '-2155.6318359375',  y = '329.27984619141', z = '0', width = '160', height = '240', size= '155' }; 
    ['Calton Heights'] = { x = '-2248.1584472656',  y = '748.20239257813', z = '0', width = '238', height = '530', size= '155' }; 
    ['City Hall'] = { x = '-2812.9992675781',  y = '296.84313964844', z = '0', width = '200', height = '160', size= '155' }; 
    ['Santa flora'] = { x = '-2738.5361328125',  y = '478.66021728516', z = '0', width = '200', height = '320', size= '155' }; 
    ['Financial'] = { x = '-1870.4908447266',  y = '848.87469482422', z = '0', width = '152', height = '320', size= '155' }; 
    ['Ganton'] = { x = '2226.7885742188',  y = '-1835.9097900391', z = '0', width = '320', height = '200', size= '155' }; 
    ['Willowfield'] = { x = '1977.2436523438',  y = '-2145.0498046875', z = '0', width = '560', height = '280', size= '155' }; 
    ['Idlewood'] = { x = '1824.6007080078',  y = '-1837.0328369141', z = '0', width = '400', height = '280', size= '155' }; 
    ['Los Flores'] = { x = '2583.2983398438',  y = '-1389.1251220703', z = '0', width = '140', height = '250', size= '155' }; 
    ['Glen Park'] = { x = '1840.0902099609',  y = '-1447.9831542969', z = '0', width = '140', height = '120', size= '155' }; 
    ['East Los Santos'] = { x = '2274.6704101563',  y = '-1549.1168212891', z = '0', width = '300', height = '390', size= '155' }; 
    ['Marina'] = { x = '668.58984375', y = '-1734.75390625', z = '0', width = '90', height = '270', size = '155' }; 
    ['Los Santos International'] = { x = '2056.7900390625', y = '-2412.576171875', z = '0', width = '100', height = '100', size = '155' }; 
    ['The High Roller'] = { x = '1837.7880859375', y = '1283.57421875', z = '0', width = '200', height = '150', size = '155' }; 
} 
  
function disableGTAZones() 
setPlayerHudComponentVisible(source, "area_name", false) 
end 
addEventHandler("onPlayerJoin", root, disableGTAZones) 
 theArea={} 
function createNewZones() 
for _, area in pairs ( areas ) do 
    theArea = createColCuboid ( area.x, area.y, area.z, area.width, area.height, area.size ); 
    setElementData(theArea, "zone_name","".._.."") 
    addEventHandler ( 'onColShapeHit', theArea, printNewZoneName ); 
     
end 
end 
addEventHandler("onResourceStart", root, createNewZones) 
  
function printNewZoneName(thePlayer,theZone) 
if getElementType(thePlayer) == "player" then 
outputChatBox(""..getElementData(theArea, "zone_name").." Entrou na zona!", thePlayer, 255, 0, 0) 
end 
end 
  

Posted

try this

local areas = { 
    ['Last Dime Motel'] = { x = '1876.0206298828',  y = '639.92822265625', z = '0', width = '110', height = '120', size= '155' };       
    ['Come-A-Lot'] = { x = '2088.8642578125',  y = '983.38934326172', z = '0', width = '250', height = '195', size= '155' }; 
    ['Redsands West'] = { x = '1297.0888671875',  y = '2101.5236816406', z = '0', width = '100', height = '100', size= '155' }; 
    ['Roca Escalante'] = { x = '2294.7055664063',  y = '2242.7463378906', z = '0', width = '320', height = '200', size= '155' }; 
    ['Pilgrim'] = { x = '2439.5773925781',  y = '1484.2821044922', z = '0', width = '170', height = '120', size= '155' }; 
    ['LVA Freight Depot'] = { x = '1576.5826416016',  y = '883.79443359375', z = '0', width = '180', height = '250', size= '155' }; 
    ['Las Venturas Airport'] = { x = '1256.7247314453',  y = '1211.0180664063', z = '0', width = '360', height = '450', size= '155' }; 
    ['t'] = { x = '1121.9184570313',  y = '2723.6286621094', z = '0', width = '410', height = '130', size= '155' }; 
    ['El Quebrados'] = { x = '-1624.2315673828',  y = '2546.4689941406', z = '0', width = '200', height = '160', size= '155' }; 
    ['Ocean Flats'] = { x = '-2800.4970703125',  y = '-203.62327575684', z = '0', width = '200', height = '460', size= '155' }; 
    ['Hashbury'] = { x = '-2586.9035644531',  y = '-207.01741027832', z = '0', width = '160', height = '250', size= '155' }; 
    ['Garcia'] = { x = '-2410.7312011719',  y = '-201.14291381836', z = '0', width = '200', height = '460', size= '155' }; 
    ['Doherty'] = { x = '-2166.2292480469',  y = '-63.644058227539', z = '0', width = '160', height = '310', size= '155' }; 
    ["King's"] = { x = '-2155.6318359375',  y = '329.27984619141', z = '0', width = '160', height = '240', size= '155' }; 
    ['Calton Heights'] = { x = '-2248.1584472656',  y = '748.20239257813', z = '0', width = '238', height = '530', size= '155' }; 
    ['City Hall'] = { x = '-2812.9992675781',  y = '296.84313964844', z = '0', width = '200', height = '160', size= '155' }; 
    ['Santa flora'] = { x = '-2738.5361328125',  y = '478.66021728516', z = '0', width = '200', height = '320', size= '155' }; 
    ['Financial'] = { x = '-1870.4908447266',  y = '848.87469482422', z = '0', width = '152', height = '320', size= '155' }; 
    ['Ganton'] = { x = '2226.7885742188',  y = '-1835.9097900391', z = '0', width = '320', height = '200', size= '155' }; 
    ['Willowfield'] = { x = '1977.2436523438',  y = '-2145.0498046875', z = '0', width = '560', height = '280', size= '155' }; 
    ['Idlewood'] = { x = '1824.6007080078',  y = '-1837.0328369141', z = '0', width = '400', height = '280', size= '155' }; 
    ['Los Flores'] = { x = '2583.2983398438',  y = '-1389.1251220703', z = '0', width = '140', height = '250', size= '155' }; 
    ['Glen Park'] = { x = '1840.0902099609',  y = '-1447.9831542969', z = '0', width = '140', height = '120', size= '155' }; 
    ['East Los Santos'] = { x = '2274.6704101563',  y = '-1549.1168212891', z = '0', width = '300', height = '390', size= '155' }; 
    ['Marina'] = { x = '668.58984375', y = '-1734.75390625', z = '0', width = '90', height = '270', size = '155' }; 
    ['Los Santos International'] = { x = '2056.7900390625', y = '-2412.576171875', z = '0', width = '100', height = '100', size = '155' }; 
    ['The High Roller'] = { x = '1837.7880859375', y = '1283.57421875', z = '0', width = '200', height = '150', size = '155' }; 
} 
  
local theArea = { } 
function disableGTAZones() 
setPlayerHudComponentVisible(source, "area_name", false) 
end 
addEventHandler("onPlayerJoin", root, disableGTAZones) 
  
function createNewZones() 
for _, area in pairs ( areas ) do 
    theArea[_] = createColCuboid ( area.x, area.y, area.z, area.width, area.height, area.size ); 
    outputChatBox("".._.."") 
    setElementData(theArea[_], "zone_name", _)   
end 
end 
addEventHandler("onResourceStart", root, createNewZones) 
  
  
addEventHandler( "onColShapeHit", theArea[_], function(hitPlayer,thePlayer)  
    if getElementType(hitPlayer)=="player" then 
outputChatBox("Puto", source) 
outputChatBox(getElementData(theZone, "zone_name").." zone entered!", source, 255, 0, 0) 
    end 
end) 

Posted

plis not work :cry:

my script

  
  
 local areas = { 
    ['Last Dime Motel'] = { x = '1876.0206298828',  y = '639.92822265625', z = '0', width = '110', height = '120', size= '155' };       
    ['Come-A-Lot'] = { x = '2088.8642578125',  y = '983.38934326172', z = '0', width = '250', height = '195', size= '155' }; 
    ['Redsands West'] = { x = '1297.0888671875',  y = '2101.5236816406', z = '0', width = '100', height = '100', size= '155' }; 
    ['Roca Escalante'] = { x = '2294.7055664063',  y = '2242.7463378906', z = '0', width = '320', height = '200', size= '155' }; 
    ['Pilgrim'] = { x = '2439.5773925781',  y = '1484.2821044922', z = '0', width = '170', height = '120', size= '155' }; 
    ['LVA Freight Depot'] = { x = '1576.5826416016',  y = '883.79443359375', z = '0', width = '180', height = '250', size= '155' }; 
    ['Las Venturas Airport'] = { x = '1256.7247314453',  y = '1211.0180664063', z = '0', width = '360', height = '450', size= '155' }; 
    ['t'] = { x = '1121.9184570313',  y = '2723.6286621094', z = '0', width = '410', height = '130', size= '155' }; 
    ['El Quebrados'] = { x = '-1624.2315673828',  y = '2546.4689941406', z = '0', width = '200', height = '160', size= '155' }; 
    ['Ocean Flats'] = { x = '-2800.4970703125',  y = '-203.62327575684', z = '0', width = '200', height = '460', size= '155' }; 
    ['Hashbury'] = { x = '-2586.9035644531',  y = '-207.01741027832', z = '0', width = '160', height = '250', size= '155' }; 
    ['Garcia'] = { x = '-2410.7312011719',  y = '-201.14291381836', z = '0', width = '200', height = '460', size= '155' }; 
    ['Doherty'] = { x = '-2166.2292480469',  y = '-63.644058227539', z = '0', width = '160', height = '310', size= '155' }; 
    ["King's"] = { x = '-2155.6318359375',  y = '329.27984619141', z = '0', width = '160', height = '240', size= '155' }; 
    ['Calton Heights'] = { x = '-2248.1584472656',  y = '748.20239257813', z = '0', width = '238', height = '530', size= '155' }; 
    ['City Hall'] = { x = '-2812.9992675781',  y = '296.84313964844', z = '0', width = '200', height = '160', size= '155' }; 
    ['Santa flora'] = { x = '-2738.5361328125',  y = '478.66021728516', z = '0', width = '200', height = '320', size= '155' }; 
    ['Financial'] = { x = '-1870.4908447266',  y = '848.87469482422', z = '0', width = '152', height = '320', size= '155' }; 
    ['Ganton'] = { x = '2226.7885742188',  y = '-1835.9097900391', z = '0', width = '320', height = '200', size= '155' }; 
    ['Willowfield'] = { x = '1977.2436523438',  y = '-2145.0498046875', z = '0', width = '560', height = '280', size= '155' }; 
    ['Idlewood'] = { x = '1824.6007080078',  y = '-1837.0328369141', z = '0', width = '400', height = '280', size= '155' }; 
    ['Los Flores'] = { x = '2583.2983398438',  y = '-1389.1251220703', z = '0', width = '140', height = '250', size= '155' }; 
    ['Glen Park'] = { x = '1840.0902099609',  y = '-1447.9831542969', z = '0', width = '140', height = '120', size= '155' }; 
    ['East Los Santos'] = { x = '2274.6704101563',  y = '-1549.1168212891', z = '0', width = '300', height = '390', size= '155' }; 
    ['Marina'] = { x = '668.58984375', y = '-1734.75390625', z = '0', width = '90', height = '270', size = '155' }; 
    ['Los Santos International'] = { x = '2056.7900390625', y = '-2412.576171875', z = '0', width = '100', height = '100', size = '155' }; 
    ['The High Roller'] = { x = '1837.7880859375', y = '1283.57421875', z = '0', width = '200', height = '150', size = '155' }; 
} 
  
function disableGTAZones() 
setPlayerHudComponentVisible(source, "area_name", false) 
end 
addEventHandler("onPlayerJoin", root, disableGTAZones) 
 theArea={} 
function createNewZones() 
for _, area in pairs ( areas ) do 
    theArea = createColCuboid ( area.x, area.y, area.z, area.width, area.height, area.size ); 
    setElementData(theArea, "zone_name","".._.."") 
    addEventHandler ( 'onColShapeHit', theArea, printNewZoneName ); 
    
end 
end 
addEventHandler("onResourceStart", root, createNewZones) 
  
function printNewZoneName(thePlayer,theZone) 
if getElementType(thePlayer) == "player" then 
outputChatBox(""..getElementData(theArea, "zone_name").." Entrou na zona!", thePlayer, 255, 0, 0) 
end 
end 
  

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