zone se cuvaju, ali ne ucitavaju

Započeo mmlinaric, Oktobar 31, 2019, 13:16:29 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 2 gostiju pregledaju ovu temu.

Problem(error/warning): zone se cuvaju, ali ne ucitavaju
Dio skripte:

Ovako se ucitavaju:
[pawn]
forward OnGangZonesLoad( );
public OnGangZonesLoad( ) {

    new rows, gangzID, string[ 256 ];
    cache_get_row_count(rows);
    if( rows ) {

        for( new i = 0; i < rows; i ++ ) {
            gangzID = i;
         cache_get_field_content_int( i, "gzone_id", gZoneInfo[ gangzID ][ gZone_ID ] );

            cache_get_field_content_int( i, "taken", gZoneInfo[ gangzID ][ gZoneTaken ] );
          cache_get_field_content_int( i, "takeable", gZoneInfo[ gangzID ][ gZoneTakeable ] );
          cache_get_field_content_int( i, "gang_id", gZoneInfo[ gangzID ][ gZoneGangSQLID ] );
          cache_get_field_content_int( i, "time", gZoneInfo[ gangzID ][ gZoneTime ] );

          gZoneInfo[ gangzID ][ gZoneMaxX ] = cache_get_field_content_float( i, "max_x" );
          gZoneInfo[ gangzID ][ gZoneMinX ] = cache_get_field_content_float( i, "min_x" );
          gZoneInfo[ gangzID ][ gZoneMaxY ] = cache_get_field_content_float( i, "max_y" );
          gZoneInfo[ gangzID ][ gZoneMinY ] = cache_get_field_content_float( i, "min_y" );

          cache_get_field_content( i, "color", gZoneInfo[ gangzID ][ gZoneColor ], _dbConnector, 24 );

          gZoneInfo[ gangzID ][ gZonePickupPos ][ 0 ]  = cache_get_field_content_float( i, "pickup_pos_x" );
         gZoneInfo[ gangzID ][ gZonePickupPos ][ 1 ]  = cache_get_field_content_float( i, "pickup_pos_y" );
         gZoneInfo[ gangzID ][ gZonePickupPos ][ 2 ]  = cache_get_field_content_float( i, "pickup_pos_z" );

         ActorPos[ gangzID ][ 0 ][ 0 ]  = cache_get_field_content_float( i, "actor_1_posx" );
         ActorPos[ gangzID ][ 0 ][ 1 ]  = cache_get_field_content_float( i, "actor_1_posy" );
         ActorPos[ gangzID ][ 0 ][ 2 ]  = cache_get_field_content_float( i, "actor_1_posz" );
         ActorPos[ gangzID ][ 0 ][ 3 ]  = cache_get_field_content_float( i, "actor_1_posa" );
         ActorPos[ gangzID ][ 1 ][ 0 ]  = cache_get_field_content_float( i, "actor_2_posx" );
         ActorPos[ gangzID ][ 1 ][ 1 ]  = cache_get_field_content_float( i, "actor_2_posy" );
         ActorPos[ gangzID ][ 1 ][ 2 ]  = cache_get_field_content_float( i, "actor_2_posz" );
         ActorPos[ gangzID ][ 1 ][ 3 ]  = cache_get_field_content_float( i, "actor_2_posa" );
         ActorPos[ gangzID ][ 2 ][ 0 ]  = cache_get_field_content_float( i, "actor_3_posx" );
         ActorPos[ gangzID ][ 2 ][ 1 ]  = cache_get_field_content_float( i, "actor_3_posy" );
         ActorPos[ gangzID ][ 2 ][ 2 ]  = cache_get_field_content_float( i, "actor_3_posz" );
         ActorPos[ gangzID ][ 2 ][ 3 ]  = cache_get_field_content_float( i, "actor_3_posa" );
         gZoneInfo[ gangzID ][ gZoneActorSkins ][ 0 ]  = cache_get_field_content_int( i, "actor_1_skin" );
         gZoneInfo[ gangzID ][ gZoneActorSkins ][ 1 ]  = cache_get_field_content_int( i, "actor_2_skin" );
         gZoneInfo[ gangzID ][ gZoneActorSkins ][ 2 ]  = cache_get_field_content_int( i, "actor_3_skin" );

            gZoneInfo[ gangzID ][ gZoneGangID ] = -1;

            if( gZoneInfo[ gangzID ][ gZoneTaken ] == 1) {

                new OrgID;
             for( new j = 1; j < MAX_ORG; j++) {
                 if( org_info[ j ][ oID ] == gZoneInfo[ gangzID ][ gZoneGangSQLID ] ) {
                     OrgID = j;
                     break;
                 }
            }
            gZoneInfo[ gangzID ][ gZonePickup ] = CreateDynamicPickup( 1313, 1, gZoneInfo[ gangzID ][ gZonePickupPos ][ 0 ], gZoneInfo[ gangzID ][ gZonePickupPos ][ 1 ], gZoneInfo[ gangzID ][ gZonePickupPos ][ 2 ], 0, 0 );
            format( string, sizeof( string ), ""col_white"[ TERITORIJA ]\nTeritorija je u vlasnistvu bande "col_server"%s"col_white"\nAko zelis da je zauzmes kucaj "col_server"/zauzmi",  org_info[ gZoneInfo[ gangzID ][ gZoneGangID ] ][ oName ] );
            gZoneInfo[ gangzID ][ gZone3D ] = CreateDynamic3DTextLabel( string, BELA, gZoneInfo[ gangzID ][ gZonePickupPos ][ 0 ], gZoneInfo[ gangzID ][ gZonePickupPos ][ 1 ], gZoneInfo[ gangzID ][ gZonePickupPos ][ 2 ], 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, 0, 0 );
            gZoneInfo[ gangzID ][ gZoneGangID ] = OrgID;
               gZoneInfo[ gangzID ][ gZoneTime ] = 0;
         }
         else {

            gZoneInfo[ gangzID ][ gZonePickup ] = CreateDynamicPickup( 1313, 1, gZoneInfo[ gangzID ][ gZonePickupPos ][ 0 ], gZoneInfo[ gangzID ][ gZonePickupPos ][ 1 ], gZoneInfo[ gangzID ][ gZonePickupPos ][ 2 ], 0, 0 );
            gZoneInfo[ gangzID ][ gZone3D ] = CreateDynamic3DTextLabel( ""col_white"[ TERITORIJA ]\nTeritorija je "col_server"slobodna"col_white"\nAko zelis da je zauzmes kucaj "col_server"/zauzmi", BELA, gZoneInfo[ gangzID ][ gZonePickupPos ][ 0 ], gZoneInfo[ gangzID ][ gZonePickupPos ][ 1 ], gZoneInfo[ gangzID ][ gZonePickupPos ][ 2 ], 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, 0, 0 );
         }
         for( new s; s < 3; s++ ) {
             gZoneInfo[ gangzID ][ gZoneActor ][ s ] = CreateActor(
               gZoneInfo[ gangzID ][ gZoneActorSkins ][ s ],
               ActorPos[ gangzID ][ s ][ 0 ],
               ActorPos[ gangzID ][ s ][ 1 ],
               ActorPos[ gangzID ][ s ][ 2 ],
               ActorPos[ gangzID ][ s ][ 3 ]
            );
            gZoneInfo[ gangzID ][ ActorAlive ][ s ] = true;
         }
         gZoneInfo[ gangzID ][ gZoneID ] = GangZoneCreate( gZoneInfo[ gangzID ][ gZoneMinX ], gZoneInfo[ gangzID ][ gZoneMinY ], gZoneInfo[ gangzID ][ gZoneMaxX ], gZoneInfo[ gangzID ][ gZoneMaxY ] );
            gZoneInfo[ gangzID ][ gZoneRectAngle ] = CreateDynamicRectangle( gZoneInfo[ gangzID ][ gZoneMinX ], gZoneInfo[ gangzID ][ gZoneMinY ], gZoneInfo[ gangzID ][ gZoneMaxX ], gZoneInfo[ gangzID ][ gZoneMaxY ], -1, -1, -1 );
        }
    }
    return (true);
}
[/pawn]
Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log): /
Slika/video ingame problema(obavezno ako je ingame problem): /

znaci, do malo prije se zone uopce nisu spremale u bazu. kreirao sam tablicu ovo ono i sad se spremaju (https://imgur.com/a/NlToJUd), ali kad restartam server one se ne stvaraju in game (ni pickup ni aktori ni zona).
Poslednja Izmena: Oktobar 31, 2019, 21:50:16 POSLE PODNE od Bašovski

cache_get_value_int
cache_get_value_float

recimo iz cache_get_field_content_int( i, "gzone_id", gZoneInfo[ gangzID ][ gZone_ID ] );
u cache_get_value_int( i, "gzone_id", gZoneInfo[ gangzID ][ gZone_ID ] );

takodjer ne mozes pola koristiti var = cache_get_field_content_float(idx, column);
a pola cache_get_field_content_float(idx, column, &var);

izgleda mi da napamet radis, samo nabacivas bez ikakvog razmisljanja, samo polako radi i debugiras dio po dio kada zapnes

I da, ovisno o verziji koju koristis, API se mjenjao po verzijama tako da i to trebas paziti i ispratiti dokumentaciju za svoju verziju
Poslednja Izmena: Oktobar 31, 2019, 13:36:41 POSLE PODNE od Ino42O
Software Developer

Citat: Ino42O poslato Oktobar 31, 2019, 13:35:34 POSLE PODNE
cache_get_value_int
cache_get_value_float

recimo iz cache_get_field_content_int( i, "gzone_id", gZoneInfo[ gangzID ][ gZone_ID ] );
u cache_get_value_int( i, "gzone_id", gZoneInfo[ gangzID ][ gZone_ID ] );

takodjer ne mozes pola koristiti var = cache_get_field_content_float(idx, column);
a pola cache_get_field_content_float(idx, column, &var);

izgleda mi da napamet radis, samo nabacivas bez ikakvog razmisljanja, samo polako radi i debugiras dio po dio kada zapnes

I da, ovisno o verziji koju koristis, API se mjenjao po verzijama tako da i to trebas paziti i ispratiti dokumentaciju za svoju verziju

zamjenio sam kod u ovo:
[pawn]
forward OnGangZonesLoad( );
public OnGangZonesLoad( ) {

    new rows, gangzID, string[ 256 ];
    cache_get_row_count(rows);
    if( rows ) {

        for( new i = 0; i < rows; i ++ ) {
            gangzID = i;
         gZoneInfo[ gangzID ][ gZone_ID ] = cache_get_field_content_int( i, "gzone_id" );

            gZoneInfo[ gangzID ][ gZoneTaken ] = cache_get_field_content_int( i, "taken" );
          gZoneInfo[ gangzID ][ gZoneTakeable ] = cache_get_field_content_int( i, "takeable" );
          gZoneInfo[ gangzID ][ gZoneGangSQLID ] = cache_get_field_content_int( i, "gang_id" );
          gZoneInfo[ gangzID ][ gZoneTime ] = cache_get_field_content_int( i, "time" );

          gZoneInfo[ gangzID ][ gZoneMaxX ] = cache_get_field_content_float( i, "max_x" );
          gZoneInfo[ gangzID ][ gZoneMinX ] = cache_get_field_content_float( i, "min_x" );
          gZoneInfo[ gangzID ][ gZoneMaxY ] = cache_get_field_content_float( i, "max_y" );
          gZoneInfo[ gangzID ][ gZoneMinY ] = cache_get_field_content_float( i, "min_y" );

          cache_get_field_content( i, "color", gZoneInfo[ gangzID ][ gZoneColor ], _dbConnector, 24 );

          gZoneInfo[ gangzID ][ gZonePickupPos ][ 0 ]  = cache_get_field_content_float( i, "pickup_pos_x" );
         gZoneInfo[ gangzID ][ gZonePickupPos ][ 1 ]  = cache_get_field_content_float( i, "pickup_pos_y" );
         gZoneInfo[ gangzID ][ gZonePickupPos ][ 2 ]  = cache_get_field_content_float( i, "pickup_pos_z" );

         ActorPos[ gangzID ][ 0 ][ 0 ]  = cache_get_field_content_float( i, "actor_1_posx" );
         ActorPos[ gangzID ][ 0 ][ 1 ]  = cache_get_field_content_float( i, "actor_1_posy" );
         ActorPos[ gangzID ][ 0 ][ 2 ]  = cache_get_field_content_float( i, "actor_1_posz" );
         ActorPos[ gangzID ][ 0 ][ 3 ]  = cache_get_field_content_float( i, "actor_1_posa" );
         ActorPos[ gangzID ][ 1 ][ 0 ]  = cache_get_field_content_float( i, "actor_2_posx" );
         ActorPos[ gangzID ][ 1 ][ 1 ]  = cache_get_field_content_float( i, "actor_2_posy" );
         ActorPos[ gangzID ][ 1 ][ 2 ]  = cache_get_field_content_float( i, "actor_2_posz" );
         ActorPos[ gangzID ][ 1 ][ 3 ]  = cache_get_field_content_float( i, "actor_2_posa" );
         ActorPos[ gangzID ][ 2 ][ 0 ]  = cache_get_field_content_float( i, "actor_3_posx" );
         ActorPos[ gangzID ][ 2 ][ 1 ]  = cache_get_field_content_float( i, "actor_3_posy" );
         ActorPos[ gangzID ][ 2 ][ 2 ]  = cache_get_field_content_float( i, "actor_3_posz" );
         ActorPos[ gangzID ][ 2 ][ 3 ]  = cache_get_field_content_float( i, "actor_3_posa" );
         gZoneInfo[ gangzID ][ gZoneActorSkins ][ 0 ]  = cache_get_field_content_int( i, "actor_1_skin" );
         gZoneInfo[ gangzID ][ gZoneActorSkins ][ 1 ]  = cache_get_field_content_int( i, "actor_2_skin" );
         gZoneInfo[ gangzID ][ gZoneActorSkins ][ 2 ]  = cache_get_field_content_int( i, "actor_3_skin" );

            gZoneInfo[ gangzID ][ gZoneGangID ] = -1;

            if( gZoneInfo[ gangzID ][ gZoneTaken ] == 1) {

                new OrgID;
             for( new j = 1; j < MAX_ORG; j++) {
                 if( org_info[ j ][ oID ] == gZoneInfo[ gangzID ][ gZoneGangSQLID ] ) {
                     OrgID = j;
                     break;
                 }
            }
            gZoneInfo[ gangzID ][ gZonePickup ] = CreateDynamicPickup( 1313, 1, gZoneInfo[ gangzID ][ gZonePickupPos ][ 0 ], gZoneInfo[ gangzID ][ gZonePickupPos ][ 1 ], gZoneInfo[ gangzID ][ gZonePickupPos ][ 2 ], 0, 0 );
            format( string, sizeof( string ), ""col_white"[ TERITORIJA ]\nTeritorija je u vlasnistvu bande "col_server"%s"col_white"\nAko zelis da je zauzmes kucaj "col_server"/zauzmi",  org_info[ gZoneInfo[ gangzID ][ gZoneGangID ] ][ oName ] );
            gZoneInfo[ gangzID ][ gZone3D ] = CreateDynamic3DTextLabel( string, BELA, gZoneInfo[ gangzID ][ gZonePickupPos ][ 0 ], gZoneInfo[ gangzID ][ gZonePickupPos ][ 1 ], gZoneInfo[ gangzID ][ gZonePickupPos ][ 2 ], 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, 0, 0 );
            gZoneInfo[ gangzID ][ gZoneGangID ] = OrgID;
               gZoneInfo[ gangzID ][ gZoneTime ] = 0;
         }
         else {

            gZoneInfo[ gangzID ][ gZonePickup ] = CreateDynamicPickup( 1313, 1, gZoneInfo[ gangzID ][ gZonePickupPos ][ 0 ], gZoneInfo[ gangzID ][ gZonePickupPos ][ 1 ], gZoneInfo[ gangzID ][ gZonePickupPos ][ 2 ], 0, 0 );
            gZoneInfo[ gangzID ][ gZone3D ] = CreateDynamic3DTextLabel( ""col_white"[ TERITORIJA ]\nTeritorija je "col_server"slobodna"col_white"\nAko zelis da je zauzmes kucaj "col_server"/zauzmi", BELA, gZoneInfo[ gangzID ][ gZonePickupPos ][ 0 ], gZoneInfo[ gangzID ][ gZonePickupPos ][ 1 ], gZoneInfo[ gangzID ][ gZonePickupPos ][ 2 ], 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, 0, 0 );
         }
         for( new s; s < 3; s++ ) {
             gZoneInfo[ gangzID ][ gZoneActor ][ s ] = CreateActor(
               gZoneInfo[ gangzID ][ gZoneActorSkins ][ s ],
               ActorPos[ gangzID ][ s ][ 0 ],
               ActorPos[ gangzID ][ s ][ 1 ],
               ActorPos[ gangzID ][ s ][ 2 ],
               ActorPos[ gangzID ][ s ][ 3 ]
            );
            gZoneInfo[ gangzID ][ ActorAlive ][ s ] = true;
         }
         gZoneInfo[ gangzID ][ gZoneID ] = GangZoneCreate( gZoneInfo[ gangzID ][ gZoneMinX ], gZoneInfo[ gangzID ][ gZoneMinY ], gZoneInfo[ gangzID ][ gZoneMaxX ], gZoneInfo[ gangzID ][ gZoneMaxY ] );
            gZoneInfo[ gangzID ][ gZoneRectAngle ] = CreateDynamicRectangle( gZoneInfo[ gangzID ][ gZoneMinX ], gZoneInfo[ gangzID ][ gZoneMinY ], gZoneInfo[ gangzID ][ gZoneMaxX ], gZoneInfo[ gangzID ][ gZoneMaxY ], -1, -1, -1 );
        }
    }
    return (true);
}
[/pawn]
(narano da ne radi xD).

inace cache_get_value_int ne postoji. koristim verziju 39-5.

u svoju obranu samo ocu reci da nisam ja radio sistem :D

Izlogiraj par varijabli pa vidi sta dobijes, svugdje prije ovih uvjeta i unutar njih
Software Developer

Citat: Ino42O poslato Oktobar 31, 2019, 14:07:15 POSLE PODNE
Izlogiraj par varijabli pa vidi sta dobijes, svugdje prije ovih uvjeta i unutar njih
FAK YEAA uspio sam nakon fixanja toga 2h :D

zamjenio sam:
[pawn]cache_get_row_count(rows);[/pawn]

sa

[pawn]cache_get_data( rows, fields, _dbConnector );[/pawn]

fala puno na pomoci ljubi brat. lock.