View Single Post
blaacky
Senior Member
Join Date: Oct 2012
Old 08-07-2013 , 06:15   Re: Check if player is entering a area/zone
Reply With Quote #19

PHP Code:
/*
* Generates all 8 points of a zone given just 2 of its points
*/
CreateZonePoints(Float:point[8][3])
{
    for(new 
i=1i<7i++)
    {
        for(new 
j=0j<3j++)
        {
            
point[i][j] = point[((>> (2-j)) & 1) * 7][j];
        }
    }

If I have a global array like Float:g_fZone[8][3] where g_fZone[0] = {0.0, 0.0, 0.0} and g_fZone[7] = {1.0, 1.0, 1.0}, the g_fZone array can be passed in the CreateZonePoints parameter and every point from 1-6 in the g_fZone array will be given their correct coordinates just by doing the function CreateZonePoints(g_fZone);

Last edited by blaacky; 08-07-2013 at 06:18.
blaacky is offline