Street Addresses (Polygon perhaps?)
#1

I've been googling this CreateDynamicPolygon a little bit, but I'm not sure if it would work.
Is there a limit to how many points I can have, or could I just add up a whole street in one Polygon?

Does anyone have any suggestions to how this would be possible?

I want to make street adresses with a textdraw on the screen which says for example "Hudson Street". I thought about IsPlayerInArea, but that would take a lot more work than if I could use the polygon.

I'm open for any suggestion, thanks in advance!

EDIT: When I say street address, I mean that I want to create an "area" on the road itself.
Reply
#2

EDIT:nvm
Reply
#3

The dynamic polygons are made with an array of floats. As long as the amount of floats in the array is divisible by two, the polygon should work correctly. However, aren't most of the roads (basically) rectangles? If I were you, I'd make a way to choose if you need to make a polygon or a rectangle area for each street you plan to cover.
Reply
#4

The GPS plugin (by Gamer_Z) supports something like this.
Reply
#5

I came over the GPS plugin a few days ago, but it doesn't really fit the thing I'm trying to do. I could probably edit the source for it, but as I don't have a clue about c++, I won't.

I figured it would be easier to use a polygon, considering the turns and all that. Then I won't have to use both polygons and rectangles on one street(hopefully).

So, a polygon, I searched for how to create them, but I didn't really understand.

Quote:

Originally Posted by Incognito
...ordered pairs (x1, y1, x2, y2, ..., xn, yn)...

pawn Код:
// This is just something I found on the forums.
new Float:Points[12] =
    {2305.5264, 1783.7133, 2305.5264, 1882.6989, 2167.5994, 1882.6989, 2167.5994, 1859.0988, 2128.2075, 1783.7133, 2305.5264, 1783.7133};
    AdminHQArea = CreateDynamicPolygon(Points, 5.0, 15.0, sizeof(Points));
In the array he made there, I see he's kind of going back and forth? I'm not sure I understand this completely, would anyone care to explain or illustrate if possible.

EDIT: Here's an example:


This is an empty picture, if anyone could illustrate for me!



Here's one of the roads I want to add, how would I do this with polygon?
Reply
#6

It would be interesting to see how accurate the area would be on such a curved road. You would basically have to start at the two corner-ends of the street and save a new point each time the road begins to curve massively...
Reply
#7

It's a neat idea and very plausible with the approach RealCop228 posted. However, may I ask why you want to implement this feature? IMO, it just seems like a TON of work for something I don't think players would really appreciate.

If you do decide to go through with it, just know there are a couple issues you would have to work out. For example, some roads cross-over each other with bridges. You would need to make a way of determining which road they are on (like checking their angle while driving (which could still be inaccurate)).
Reply
#8

I would personally make a visual 'polygon placer' script so you can adjust it accordingly in-game. Seems a lot of work for something so minor though.
Reply
#9

Well, it was just an idea actually I'm still not sure I'll go through with it. I'm just looking for the easiest way to do it! I tried making saving the coords of that street I marked, from bottom to end, but when I added the points, it ended up by making a small rectangle! : /

I'm not sure I understand this polygon thing! Haha

EDIT: When I understand the feature completely, it won't be that much work actually, then I could just add a function so that I could do everything ingame. If I go through with it, it will be dynamic, so it shouldn't be too hard!

pawn Код:
new Float:HudsonStreetPoints[21] = {
83.1891, -1521.9076,
103.5215, -1525.9276,
107.7377, -1507.3275,
91.5140, -1499.7322,
99.0169, -1484.8521,
116.9016, -1490.1781,
111.6641, -1466.5155,
129.3140, -1473.2096,
159.6974, -1401.8643,
175.9282, -1414.5192
};
new HudsonStreet;

hook OnGameModeInit()
{
    HudsonStreet = CreateDynamicPolygon(HudsonStreetPoints, 5.0, 15.0, sizeof(HudsonStreetPoints));
    return 1;
}

public OnPlayerEnterDynamicArea(playerid, areaid)
{
    if(areaid == HudsonStreet)
    {
        ShowCustomPopup(playerid, "Hudson Street Baby");
    }
    return 1;
}

public OnPlayerLeaveDynamicArea(playerid, areaid)
{
    if(areaid == HudsonStreet)
    {
        HideCustomPopup(playerid);
    }
    return 1;
}
Any reason this should not work?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)