21.01.2014, 18:57
//EDIT: forgot to change the params of the control structure from wiki in my first post, sorry! fixed that by now
well, you don't really have to #define it. You can write comments to the area lines in the switch of the function
but yeah, that's how it works
also, just coded that, in case you need to get a area id:
well, you don't really have to #define it. You can write comments to the area lines in the switch of the function
but yeah, that's how it works

also, just coded that, in case you need to get a area id:
pawn Код:
stock GetAreaID(playerid)
{
new Float:p[3],Float:ap[4],areaid;
GetPlayerPos(playerid, p[0], p[1], p[2]);
for(new i=0; i<3; i++)//loop for the areas you've defined, it's 3 here. ( 0.. 1.. 2)
{
switch(i)
{
case 0: ap[0] = 1212.34234, ap[1] = 234.123, ap[2] = -111.222, ap[3] = 213.44;
case 1: ap[0] = 1212.34234, ap[1] = 234.123, ap[2] = -111.222, ap[3] = 213.44;
case 2: ap[0] = 1212.34234, ap[1] = 234.123, ap[2] = -111.222, ap[3] = 213.44;
//and so on, add your areas...
}
if(p[0] <= ap[0] && p[0] >= ap[1] && p[1] <= ap[2] && p[1] >= ap[3]) return i;//return the area-id
}
return -1;//failed, player is not in a area defined by you, returning 0. But... 0 is an area id too, we'll just go with -1 i guess
//or either change the switch + loop, starting with 1
}