Jump to content

help


Apo

Recommended Posts

hi guys

 my problem hillarea worked all interior and all dimension i need worked only in interior 30 and dimension 30 please helpe me.

 

local hillArea = createColRectangle ( -2171.0678710938, 678.17950439453, 15, 15 )


function hill_Enter ( thePlayer, matchingDimension )
        if getElementType ( thePlayer ) == "player" then 

                local nameOfThePlayer = getPlayerName ( thePlayer )

	        outputChatBox ( nameOfThePlayer.." entered the zone!", getRootElement(), 255, 255, 109 )
        end
end
addEventHandler ( "onColShapeHit", hillArea, hill_Enter )

 

Link to comment

Try this

 

  1. local hillArea = createColRectangle ( -2171.0678710938, 678.17950439453, 15, 15 )
  2. setElementInterior ( hillArea, 30 )
  3. setElementDimension hillArea, 30)
  4.  
  5. function hill_Enter ( thePlayer, matchingDimension )
  6. if getElementType ( thePlayer ) == "player" then
  7.  
  8. local nameOfThePlayer = getPlayerName ( thePlayer )
  9.  
  10. outputChatBox ( nameOfThePlayer.." entered the zone!", getRootElement(), 255, 255, 109 )
  11. end
  12. end
  13. addEventHandler ( "onColShapeHit", hillArea, hill_Enter )
Edited by Jinx099
Link to comment

What about this?

local hillArea = createColRectangle ( -2171.0678710938, 678.17950439453, 15, 15 )

function hill_Enter ( thePlayer, matchingDimension )
	if getElementType ( thePlayer ) == "player" then
		local interior = getElementInterior(thePlayer)
		if interior == 30 and matchingDimension == 30 then
			local nameOfThePlayer = getPlayerName ( thePlayer )
			outputChatBox ( nameOfThePlayer.." entered the zone!", getRootElement(), 255, 255, 109 )
		end
	end
end
addEventHandler("onColShapeHit", hillArea, hill_Enter)

 

Link to comment
local hillArea = createColRectangle ( -2171.0678710938, 678.17950439453, 15, 15 )


function hill_Enter ( thePlayer, matchingDimension )
  if getElementType ( thePlayer ) == "player" then
    if ( ( getElementInterior( thePlayer) == 30 ) and ( matchingDimension ) ) then
	local nameOfThePlayer = getPlayerName ( thePlayer )
	outputChatBox ( nameOfThePlayer.." entered the zone!", getRootElement(), 255, 255, 109 )
    end
  end
end
addEventHandler ( "onColShapeHit", hillArea, hill_Enter )

Colshapes are created for all dimensions so you have to check within the function attached to the event if it the element that hit it is in the same dimension by checking if the argument variable 'matchingDimension' is true or false. If its true then they are in the same dimension but in your case you must check the elements interior too.

Edited by Pembo
  • Like 1
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...