A little help regarding polygons
#1

I'm trying to fullfill a dynamic poligon that i made using the Incognito's streamer i tried making a loop from one corner of the polygon to the oposite one but im getting half of the poligon filled. Just to be more specific i will show you an image:



I tried using this code:
pawn Code:
new Float:zones_points_9[] = {
    -291.0,-76.0,39.0,-144.0,56.0,-73.0,84.0,29.0,20.0,75.0,-100.0,147.0,-199.0,184.0,-291.0,-76.0
};
public OnGameModeInit()
{
    Terrenos[9] = CreateDynamicPolygon(zones_points_9);
    new Float:zPos;
    for(new y = 71; y > -125; y -= 3)
    {
        for(new x = 16; x < 83; x += 3)
        {
            GetPointZPos(x,y,zPos);
                CreateDynamicPickup(1239, 2, x,y,zPos+2,-1,-1,-1,50.0);
            printf("%d %d", x,y);
        }
    }
return 1;
}
But just like i said im getting half of the polygon filled.
Reply
#2

Well basically, even if this was the correct code or not, not all the pickups are going to be seen. As of 0.3z, the limit of pickups is 4096 for each client. (https://sampwiki.blast.hk/wiki/Limits)

I tested this, and by creating a new pickup every '3' units, you reach a total of 8530 pickups within the polygon. By creating a new pickup every '5' units, you reduce this amount to 3070 which is well below the pickup limit. So your code would simply be:
pawn Code:
new Float:zones_points_9[] = {
    -291.0,-76.0,39.0,-144.0,56.0,-73.0,84.0,29.0,20.0,75.0,-100.0,147.0,-199.0,184.0,-291.0,-76.0
};
public OnGameModeInit()
{
    Terrenos[9] = CreateDynamicPolygon(zones_points_9);
    new Float:zPos;
    for(new y = -144; y < 184; y += 5)
    {
        for(new x = -291; x < 84; x += 5)
        {
            if(!IsPointInDynamicArea(Terrenos[9], x, y, 0.0)) continue;
            GetPointZPos(x, y, zPos);
            CreateDynamicPickup(1239, 2, x, y, zPos + 2, -1, -1, -1, 50.0);
            printf("%d %d", x, y);
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)