GangZones
#1

Gangzones aren't showing when they load.

I've checked if they're loading correctly from floats:

pawn Код:
stock Turf_Load(i)
{
    new query[420], savingstring[20];
    format(query, sizeof(query), "SELECT * FROM GangZone WHERE TurfID=%d",i);
    mysql_query(query);
    mysql_store_result();
    while(mysql_fetch_row_format(query,"|"))
    {
        mysql_fetch_field_row(savingstring, "North"); TurfData[i][North] = floatstr(savingstring);
        mysql_fetch_field_row(savingstring, "South"); TurfData[i][South] = floatstr(savingstring);
        mysql_fetch_field_row(savingstring, "East"); TurfData[i][East] = floatstr(savingstring);
        mysql_fetch_field_row(savingstring, "West"); TurfData[i][West] = floatstr(savingstring);
        mysql_fetch_field_row(savingstring, "Color"); TurfData[i][TurfColor] = strval(savingstring);
        mysql_fetch_field_row(TurfData[i][TurfName],"TurfName");
        TurfData[i][tTurfID] = GangZoneCreate(TurfData[i][West], TurfData[i][South], TurfData[i][East], TurfData[i][North]);

        switch(TurfData[i][TurfColor])
        {
            case 0: GangZoneShowForAll(TurfData[i][tTurfID], COLOR_WHITE);
            case 1: GangZoneShowForAll(TurfData[i][tTurfID], COLOR_BLUE);
            case 2: GangZoneShowForAll(TurfData[i][tTurfID], COLOR_GREEN);
            case 3: GangZoneShowForAll(TurfData[i][tTurfID], COLOR_YELLOW);
            case 4: GangZoneShowForAll(TurfData[i][tTurfID], COLOR_ORANGE);
            case 5: GangZoneShowForAll(TurfData[i][tTurfID], COLOR_PURPLE);
            case 6: GangZoneShowForAll(TurfData[i][tTurfID], COLOR_RED);
        }

    }
    return 1;
}
Код:
[00:52:09] CMySQLHandler::Query(SELECT * FROM GangZone WHERE TurfID=1) - Successfully executed.

[00:52:09] >> mysql_store_result( Connection handle: 1 )

[00:52:09] CMySQLHandler::StoreResult() - Result was stored.

[00:52:09] >> mysql_fetch_row_format( Connection handle: 1 )

[00:52:09] CMySQLHandler::FetchRow() - Return: |1|0|-1737.82|-1747.71|-1737.58|-1738.29

[00:52:09] >> mysql_fetch_field_row( Connection handle: 1 )

[00:52:09] CMySQLHandler::FetchField("North") - -1737.82

[00:52:09] >> mysql_fetch_field_row( Connection handle: 1 )

[00:52:09] CMySQLHandler::FetchField("South") - -1747.71

[00:52:09] >> mysql_fetch_field_row( Connection handle: 1 )

[00:52:09] CMySQLHandler::FetchField("East") - -1737.58

[00:52:09] >> mysql_fetch_field_row( Connection handle: 1 )

[00:52:09] CMySQLHandler::FetchField("West") - -1738.29

[00:52:09] >> mysql_fetch_field_row( Connection handle: 1 )

[00:52:09] CMySQLHandler::FetchField("Color") - 0

[00:52:09] >> mysql_fetch_field_row( Connection handle: 1 )

[00:52:09] CMySQLHandler::FetchField("TurfName") - 

[00:52:09] >> mysql_fetch_row_format( Connection handle: 1 )

[00:52:09] >> mysql_query( Connection handle: 1 )
Any idea why this isn't working?

I'm not too familiar with Gangzones so maybe I'm just using the functions incorrectly?
Reply
#2

I'm not at home so i can't verify by myself, but are you sure that the coordinates are ok? I don't really know what you mean by "North, South, East, West" but keep in mind that maxX and maxY are the values from the right upper corner of the zone and minX minY are the values of the lower left corner. 1 is for min and 2 is for max.


You can use this to help you create the gangzones.
https://sampforum.blast.hk/showthread.php?tid=279647
Reply
#3

pawn Код:
[20:14:47] W: -1738.290039 S: -1747.709960 E: -1737.579956 N: -1737.819946
This is what i'm loading for my coords.

Where:

pawn Код:
TurfData[i][tTurfID] = GangZoneCreate(TurfData[i][West], TurfData[i][South], TurfData[i][East], TurfData[i][North]);
        new String[128];
        format(String, sizeof String, "W: %f S: %f E: %f N: %f",TurfData[i][West], TurfData[i][South], TurfData[i][East], TurfData[i][North]);
        printf(String);
Still not showing..
Reply
#4

pawn Код:
if(TurfData[i][East] < TurfData[i][West])
{
    new Float:var = TurfData[i][East];
    TurfData[i][East] = TurfData[i][West];
    TurfData[i][West] = var;
}

if(TurfData[i][North] < TurfData[i][South])
{
    new Float:var = TurfData[i][North];
    TurfData[i][North] = TurfData[i][South];
    TurfData[i][South] = var;
}
Your North (maxy) is less than your South (miny). Same with your East + West. Thus it won't show.
Reply
#5

Yeah, It ended up being a coordinate thing.

Just used a program to get the coordinates and it worked.

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)