Apo Posted April 8, 2017 Posted April 8, 2017 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 )
Jinx099 Posted April 8, 2017 Posted April 8, 2017 (edited) Try this local hillArea = createColRectangle ( -2171.0678710938, 678.17950439453, 15, 15 ) setElementInterior ( hillArea, 30 ) setElementDimension ( hillArea, 30) 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 ) Edited April 8, 2017 by Jinx099
Apo Posted April 8, 2017 Author Posted April 8, 2017 (edited) not work all dimension and interior worked Edited April 8, 2017 by Apo
Bananovy Posted April 8, 2017 Posted April 8, 2017 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)
Function Posted April 8, 2017 Posted April 8, 2017 I think with.. setElementInterior(hillArea,30) setElementDimension(hillArea,30)
Pembo Posted April 8, 2017 Posted April 8, 2017 (edited) 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 April 8, 2017 by Pembo 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now