06.07.2011, 02:58
pawn Код:
new ZoneName[MAX_PLAYERS][128];
enum IntZoneInfo
{
IntName[27],
Float:IntMinX,
Float:IntMinY,
Float:IntMaxX,
Float:IntMaxY
}
new Float:IntZone[][IntZoneInfo] =
{
{ "Cluckin Bell", 362.6255, -12.18620, 381.4123, -6.106100},
{ "Ammunation", 283.9484, -112.9781, 298.6097, -102.7812}
};
stock GetPlayerInteriorName(playerid)
{
new Float:posX, Float:posY, Float:posZ;
GetPlayerPos(playerid, posX, posY, posZ);
if(posZ > 500.0)
{
for(new i=0; i < sizeof(IntZone); i++)
{
if(IsPlayerInArea(playerid, IntZone[playerid][IntMinX], IntZone[playerid][IntMinY], IntZone[playerid][IntMaxX], IntZone[playerid][IntMaxY]))
{
format(ZoneName[playerid], 128, IntZone[playerid][IntName]);
}
}
}
else
{
ZoneName[playerid] = "Unknown";
}
return ZoneName[playerid];
}
stock IsPlayerInArea(playerid, Float:minX, Float:minY, Float:maxX, Float:maxY)
{
new Float:posX, Float:posY, Float:posZ;
GetPlayerPos(playerid, posX, posY, posZ);
if(posX >= minX && posX <= maxX && posY >= minY && posY <= maxY) return 1;
return 0;
}