14.07.2011, 15:56
pawn Код:
new Float:Cities[][CityInfo] = {
{ "Los Santos", 44.60, -2892.90, -242.90, 2997.00, -768.00, 900.00},
{ "Las Venturas", 869.40, 596.30, -242.90, 2997.00, 2993.80, 900.00},
{ "San Fierro", -2997.40, -1115.50, -242.90, -1213.90, 1659.60, 900.00}
pawn Код:
//Don't add this if you're already having something to get zones like idlewood or w/e. Just replace it.
enum CityInfo
{
zone_name[30],
Float:zone_minx,
Float:zone_miny,
Float:zone_minz,
Float:zone_maxx,
Float:zone_maxy,
Float:zone_maxz
}
pawn Код:
stock GetPlayerCity(playerid)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
for(new i=0;i<sizeof(Zones);i++)
{
if(x > Zones[i][zone_minx] && y > Zones[i][zone_miny] && z > Zones[i][zone_minz] && x < Zones[i][zone_maxx] && y < Zones[i][zone_maxy] && z < Zones[i][zone_maxz])
return i;
}
return false;
}