Sign in to follow this  
IgorRodriguesCo

Interesting question.

Recommended Posts

Id like to know if there is a way to check if the player is under a roof, as happens in the game.

For example, when its raining and you go under a bridge, the effect of rain stop and when you come out, start again.

Share this post


Link to post

Hm. Rather MTA doesn't share any trigger what allows that, anyway I didn't see this. But maybe there possibility use ProcessLineOfSight and check ray collision from player to roof. 
Example: 
 

processLineOfSight(playerX, playerY, playerZ, playerX, playerY, playerZ + maxHeightOfRoof)

Or use optional arguments with objects ID. 

Edited by Verius

Share this post


Link to post
2 hours ago, Verius said:

Hm. Rather MTA doesn't share any trigger what allows that, anyway I didn't see this. But maybe there possibility use ProcessLineOfSight and check ray collision from player to roof. 
Example: 
 


processLineOfSight(playerX, playerY, playerZ, playerX, playerY, playerZ + maxHeightOfRoof)

Or use optional arguments with objects ID. 

Maybe it can work, good ideia

Edited by IgorRodriguesCo

Share this post


Link to post
function isElementUnderRoof(el)
	local x, y, z = getElementPosition(el)
		if getGroundPosition(x,y, z) == getGroundPosition(x,y,z+ 800) then
			return false
		else
			return true
		end
end

Use this.

Share this post


Link to post
1 hour ago, Egekan said:

function isElementUnderRoof(el)
	local x, y, z = getElementPosition(el)
		if getGroundPosition(x,y, z) == getGroundPosition(x,y,z+ 800) then
			return false
		else
			return true
		end
end

Use this.

Works, but not well

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.