21.01.2014, 18:38
you could do something like this
usage would be,
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
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
}
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?");
of passing down the coords to the func. like in the wiki example