SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 19/12/2014, 01:05 AM   #1
JustBored
High-roller
 
JustBored's Avatar
 
Join Date: Jan 2013
Location: Buenos Aires - Argentina
Posts: 1,150
Reputation: 134
Default A little help regarding polygons

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.
__________________
"Compiler - A program designed to tell you how wrong you are. It's a great way to induce stress and frustration."

JustBored is offline   Reply With Quote
Old 19/12/2014, 04:39 AM   #2
Threshold
High-roller
 
Threshold's Avatar
 
Join Date: Nov 2012
Location: Australia
Posts: 3,125
Reputation: 529
Default Re: A little help regarding polygons

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. (http://wiki.sa-mp.com/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;
}
__________________


Kar's Cops and Robbers 2020
Threshold is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] polygons Seregamil1 Includes 16 10/11/2014 09:11 PM
[Include] polygons Seregamil1 Релизы/Releases 6 06/11/2014 06:47 AM
Polygons on models PixeledNinja Client Support 12 20/05/2012 09:44 PM


All times are GMT. The time now is 08:42 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.