Getting Zone Size
#1

I have another question regarding zones, is there a way to get the size of a zone?
Reply
#2

I don't think you can get the actual size of the zone without setting some values yourself and using that to calculate the size, such as

Код:
new Float:tminx, Float: tminy, Float: tmaxx, Float: tmaxy;
and then something like,
Код:
                    tminx = GetPVarFloat(playerid, "EditingTurfsMinX");
                    tminy = GetPVarFloat(playerid, "EditingTurfsMinY");
                    tmaxx = GetPVarFloat(playerid, "EditingTurfsMaxX");
                    tmaxy = GetPVarFloat(playerid, "EditingTurfsMaxY");
It should be something like that i do not know exactly.
Reply
#3

Quote:
Originally Posted by Clora
Посмотреть сообщение
I don't think you can get the actual size of the zone without setting some values yourself and using that to calculate the size, such as

Код:
new Float:tminx, Float: tminy, Float: tmaxx, Float: tmaxy;
and then something like,
Код:
                    tminx = GetPVarFloat(playerid, "EditingTurfsMinX");
                    tminy = GetPVarFloat(playerid, "EditingTurfsMinY");
                    tmaxx = GetPVarFloat(playerid, "EditingTurfsMaxX");
                    tmaxy = GetPVarFloat(playerid, "EditingTurfsMaxY");
It should be something like that i do not know exactly.
I know I'd need to do that much, I need to know if they're any actual math I can do to return the area of the zone or if there's already a function out there either natively in SA-MP or an include that's been made that does this.
Reply
#4

Area = Length x Width...

Area = (tmaxx - tminx) * (tmaxy - tminy);

[This only applies to zones that are rectangular or square, not zones such as circles or polygonal]
Reply
#5

Quote:
Originally Posted by Threshold
Посмотреть сообщение
Area = Length x Width...

Area = (tmaxx - tminx) * (tmaxy - tminy);

[This only applies to zones that are rectangular or square, not zones such as circles or polygonal]
Alright, thanks for the help
Reply
#6

Quote:
Originally Posted by Threshold
Посмотреть сообщение
Area = Length x Width...

Area = (tmaxx - tminx) * (tmaxy - tminy);

[This only applies to zones that are rectangular or square, not zones such as circles or polygonal]
Threshold said it much better than i could
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)