[Help] Gangzones
#3

you could do something like this

pawn Код:
stock IsInArea(playerid, area)
{
    new Float:p[3],Float:ap[4];
    GetPlayerPos(playerid, p[0], p[1], p[2]);
    switch(area)
    {
        case 0: ap[0] = 1212.34234, ap[1] = 234.123, ap[2] = -111.222, ap[3] = 213.44;//some area coords
        case 1: ap[0] = 1212.34234, ap[1] = 234.123, ap[2] = -111.222, ap[3] = 213.44;//some area coords
        case 2: ap[0] = 1212.34234, ap[1] = 234.123, ap[2] = -111.222, ap[3] = 213.44;//some area coords
        //and so on, add your areas...
    }
   if(p[0] <= ap[0] && p[0] >= ap[1] && p[1] <= ap[2] && p[1] >= ap[3]) return 1;//if players coords are within the area, return 1 for true
    return -1;//if players coords are not within the area, returning 0. But... 0 is an area id too, we'll just go with -1 i guess or either change the switch, starting with 1
}
usage would be,
PHP код:
//just define some areas with numbers... lets say groove st is id 0 for example.
if(IsInArea(playerid,0)) printf("it's Groove st.!");
else 
printf("where am i?"); 
like this, you just have to type the area's id when youre using the function instead
of passing down the coords to the func. like in the wiki example
Reply


Messages In This Thread
[Help] Gangzones - by BornHuman - 21.01.2014, 18:27
Re: [Help] Gangzones - by Ace155 - 21.01.2014, 18:33
Re: [Help] Gangzones - by CutX - 21.01.2014, 18:38
Re: [Help] Gangzones - by BornHuman - 21.01.2014, 18:47
Re: [Help] Gangzones - by CutX - 21.01.2014, 18:57
Re: [Help] Gangzones - by BornHuman - 21.01.2014, 19:03
Re: [Help] Gangzones - by CutX - 21.01.2014, 19:15
Re: [Help] Gangzones - by BornHuman - 21.01.2014, 19:33

Forum Jump:


Users browsing this thread: 1 Guest(s)