12.03.2015, 14:13
... anyway. You need to do three things. It's weird but there doesn't seem to be any "GetZonenameFromPosition" available. https://sampforum.blast.hk/showthread.php?tid=27598 - get yourself this include. Open it, and change
This will make that array available across files. Ok, now we need new function adapted from GetPlayer2DZone
And almost done.
Tadah
pawn Код:
static const gSAZones[][SAZONE_MAIN]
//into
new const gSAZones[][SAZONE_MAIN]
pawn Код:
stock Get2DZoneFromCoordinates(Float:x, Float:y, Float:z, zone[], len = sizeof(zone))
{
for(new i = 0; i != sizeof(gSAZones); i++ )
{
if(x >= gSAZones[i][SAZONE_AREA][0] && x <= gSAZones[i][SAZONE_AREA][3] && y >= gSAZones[i][SAZONE_AREA][1] && y <= gSAZones[i][SAZONE_AREA][4])
{
return format(zone, len, gSAZones[i][SAZONE_NAME], 0);
}
}
return 0;
pawn Код:
stock CreateDynamicDoor(doorid)
{
new
string[128],
zone[29]
;
Get2DZoneFromCoordinates(DDoorsInfo[doorid][ddExteriorX], DDoorsInfo[doorid][ddExteriorY], DDoorsInfo[doorid][ddExteriorZ], zone);
if(DDoorsInfo[doorid][ddType] != 0) format(string, sizeof(string), "%s\nBuilding owner: %s\nBuilding Address: %d %s", DDoorsInfo[doorid][ddDescription], StripUnderscore(DDoorsInfo[doorid][ddOwnerName]), doorid, zone);
else format(string, sizeof(string), "%s\nBuilding Address: %d %s", DDoorsInfo[doorid][ddDescription], doorid, zone);