Dynamic Door Zone (+REP)
#4

... 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
pawn Код:
static const gSAZones[][SAZONE_MAIN]

//into

new const gSAZones[][SAZONE_MAIN]
This will make that array available across files. Ok, now we need new function adapted from GetPlayer2DZone

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;
And almost done.

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);
Tadah
Reply


Messages In This Thread
Dynamic Door Zone (+REP) - by Trevor Gin - 12.03.2015, 13:22
Re: Dynamic Door Zone (+REP) - by Misiur - 12.03.2015, 13:42
Re: Dynamic Door Zone (+REP) - by Trevor Gin - 12.03.2015, 13:43
Re: Dynamic Door Zone (+REP) - by Misiur - 12.03.2015, 14:13
Re: Dynamic Door Zone (+REP) - by Trevor Gin - 12.03.2015, 14:55
Re: Dynamic Door Zone (+REP) - by Misiur - 12.03.2015, 15:14
Re: Dynamic Door Zone (+REP) - by Trevor Gin - 12.03.2015, 15:19

Forum Jump:


Users browsing this thread: 1 Guest(s)