How to calculate cube area(?)
#1

Hello guys! So, I got a little problem when I was writing my new house system. I want to make a 0.3.7 house system which are 0.3.7 - 0.3x.. houses. But I got a very big problem what I can't resolve. So, I just type my /createhouse and I make a new house next to the garage, like in Single Player. After that, I want the system to calculate my own house area in a cube.. because some players are making fun when they put some furniture in house, and they always wanna move on streets to block the traffic. There is a way to create a cube automatically when I create a house?



The yellow is a house pickup.. ( I put there because it's 0.3c house and I want a furniture system )
and I want the system to calculate all house area when I create it. Idea?
Reply
#2

Use Dynamic Spheres/rectangles, checkout the streamer plugin for the correct syntax, I'm on my phone atm.
Reply
#3

so? can you help me?
Reply
#4

You can store the minimum x/y and maximum x/y positions of the valid area for each house, and then check if it is inside these coordinates when placing furniture.

pawn Код:
if ((minx <= furniture_x <= maxx)) && (miny <= furniture_y <= maxy)) {
    // Valid area
} else {
    // Invalid area
}
Reply
#5

That's my problem.. I don't have any minx and miny coordinates, and I want to calculate that when I create a house somewhere. I don't need to save each house area just one because all are same, but I don't know how to calculate that area and to make a little zone on minimap.
Reply
#6

If you are using the same basic object model you can get the offset to the road, and it should translate assuming the house is always the same distance from the road.
Reply
#7

Area of a cube is Side squared.

Quote:
Originally Posted by feheristi97
Посмотреть сообщение
That's my problem.. I don't have any minx and miny coordinates, and I want to calculate that when I create a house somewhere. I don't need to save each house area just one because all are same, but I don't know how to calculate that area and to make a little zone on minimap.
You have the house actual X,Y,Z position. What you want is called offsets, which are coordinates around a point.

You can allow the player to move them until a certain offset, for example, a 10 units offset would be:

X-10, X+10, Y-10, Y+10 and restrict it at Z+2, X,Y,Z being the actual coordinates of the house. And there you have it, a cube 10 units around the original coordinates, with a height of 2.
Reply
#8

can you help me please in code?
Reply
#9

The simplest method of doing this would be using IsPlayerInRangeOfPoint(though offsets / areas are more efficient).

wiki.sa-mp.com/wiki/IsPlayerInRangeOfPoint
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)