Jump to content

isInsideRadarArea


#Dv^

Recommended Posts

Hola, estoy tratando de que el player al entrar al Cubo, no pueda recibir daño, pero me sale un error con el "isInsideRadarArea"

 

s1 = createColCuboid( 3265.91528, -1913.1,7, 4.8,8.4,3.5 )
s2 = createColCuboid( 3163.91528, -1912.4,7, 4.8,8.4,3.5 )
s3 = createColCuboid( 3166.5, -2016.9,7,8.3,4.5,3.5 )
s4 = createColCuboid( 3270.5, -2018.4,7, 4.8,8.4,3.5 )

local zones = { s1 , s2 , s3 , s4 };


for m in pairs ( zones ) do

addEventHandler("onClientPlayerDamage", getLocalPlayer(),
	function()
	local x, y = getElementPosition(localPlayer)
		if isInsideRadarArea(zones[m],x,y) then
			cancelEvent()
		end
	end
)

end

Aún así el daño dentro del Cubo sigue estando

Link to comment
if not isElementWithinColShape(source, zones[m]) then

¿En vez de usar for para obtener todos los cubos, que otro se puede usar?

Algo como 
 

local s1 = createColCuboid( 3255.5, -1910.1,7, 8.4,4.8,3.5 )
local s2 = createColCuboid( 3166.4, -1912.4,7, 4.8,8.4,3.5 )
local s3 = createColCuboid( 3166.1, -2019.3,7,8.3,4.5,3.5 )
local s4 = createColCuboid( 3274.2, -2022.4,7, 4.8,8.4,3.5 )

local zones = { s1 , s2 , s3 , s4 };

if not isElementWithinColShape(source, zones) then

 

Edited by Slash14
Link to comment
local _isElementWithinColShape = isElementWithinColShape

function isElementWithinColShape(element, colshapes)
  if type(colshapes) == "table" then
    for i = 1, #colshapes do
      if _isElementWithinColShape(element, colshapes[i] then
          return true
      end
    end
    return false
  else
    return _isElementWithinColShape(element, colshapes)
  end
end

 

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...