Oko vozila

Započeo BoZZ, Jun 23, 2019, 21:21:21 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 4 gostiju pregledaju ovu temu.

Problem(error/warning): Nije error vec ovako.. Znaci na serveru se kreiraju vozila sve lepo koliko hoces i sad kada se restarta server, a vozila ima vise od 300 ta vozila jednostavno nema, a u sql se upisu
Deo skripte: [pawn]dat cu sta treba[/pawn]
Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log): [debug] Run time error 4: "Array index out of bounds"
[debug]  Attempted to read/write array element at negative index -1
[debug] AMX backtrace:
[debug] #0 00531e70 in SetVehicleLabels (i=302) at C:\Users\Korisnik\Desktop\Igrice\MH - 1.0.0\gamemodes\MH_Script.pwn:12325
[debug] #1 0061edfc in public OnVehiclesLoad (playerid=1001, targetid=1001, moneyauc=0) at

Slika/video ingame problema(obavezno ako je ingame problem): //

Provjeri jel imas definirano MAX_VOZILA ili MAX_VEHICLE ili nesto u tom smislu  i vjerojatno kad pokrenes mod na ucitavanju postoji neka for petlja koja ne prolazi preko 300. Provjeri jel dobivas cijelu tabelu vozila ili samo tih 300 pod ucitavanjem vozila

[pawn]#undef MAX_VEHICLES
const MAX_VEHICLES =          2000;[/pawn]

ima ovo


Citat: y_Dev poslato Jun 24, 2019, 13:20:16 POSLE PODNE
pa citaj log lol...
Pa problem je sto kad se izbrisu vozila ispod 300 debuga nema

Pošalji nam public OnVehiclesLoad

Citat: dirigent00 poslato Jun 24, 2019, 13:41:36 POSLE PODNE
Pošalji nam public OnVehiclesLoad
Eto
[pawn]protected OnVehiclesLoad( playerid, targetid, moneyauc )
{
   new rows, fields, vehicleid;
    cache_get_data( rows, fields, mSQL );

   if( rows )
   {
      for( new i = 0; i < rows; i ++ )
      {
            vehicleid = mh_CreateVehicle( cache_get_field_content_int( i, "v_model" ),
                                    cache_get_field_content_float( i, "v_pos_x" ),
                                    cache_get_field_content_float( i, "v_pos_y" ),
                                    cache_get_field_content_float( i, "v_pos_z" )+1.0,
                                    cache_get_field_content_float( i, "v_pos_a" ),
                                    cache_get_field_content_int( i, "v_color_1" ),
                                    cache_get_field_content_int( i, "v_color_2" ), 300000 );

            VehicleInfo[ vehicleid ][ vSqlID ] = cache_get_field_content_int( i, "veh_id" );
         VehicleInfo[ vehicleid ][ vOwner_sqlID ] = cache_get_field_content_int( i, "owner_sqlID" );
         strmid( VehicleInfo[ vehicleid ][ vOwner ], "Drzava", 0, strlen( "Drzava" ), 24);
         VehicleInfo[ vehicleid ][ vPrice ] = cache_get_field_content_int( i, "v_price" );
         VehicleInfo[ vehicleid ][ vLocked ] = cache_get_field_content_int( i, "v_locked" );
         VehicleInfo[ vehicleid ][ vLokacijaX ] = cache_get_field_content_float( i, "v_pos_x" );
         VehicleInfo[ vehicleid ][ vLokacijaY ] = cache_get_field_content_float( i, "v_pos_y" );
         VehicleInfo[ vehicleid ][ vLokacijaZ ] = cache_get_field_content_float( i, "v_pos_z" );
         VehicleInfo[ vehicleid ][ vLokacijaA ] = cache_get_field_content_float( i, "v_pos_a" );
         VehicleInfo[ vehicleid ][ vVirtualWorld ] = cache_get_field_content_int( i, "v_virtualw" );
         VehicleInfo[ vehicleid ][ vInterior ] = cache_get_field_content_int( i, "v_interior" );
         VehicleInfo[ vehicleid ][ vUsage ] = cache_get_field_content_int( i, "v_usage" );
         VehicleInfo[ vehicleid ][ vOrganizationSQLID ] = cache_get_field_content_int( i, "v_organization" );
         VehicleInfo[ vehicleid ][ vOrganization ] = -1;

         if( VehicleInfo[ vehicleid ][ vOrganizationSQLID ] != 0 ) {
                for( new j = 1; j < MAX_ORG; j++) {
                 if( org_info[ j ][ oID ] == VehicleInfo[ vehicleid ][ vOrganizationSQLID ] ) {
                     VehicleInfo[ vehicleid ][ vOrganization ] = j;
                     break;
                 }
             }
         }

         VehicleInfo[ vehicleid ][ vJob ] = cache_get_field_content_int( i, "v_job" );
         VehicleInfo[ vehicleid ][ vFuelStation ]  = cache_get_field_content_int( i, "v_fuel_station" );
         VehicleInfo[ vehicleid ][ vColor1 ] = cache_get_field_content_int( i, "v_color_1" );
         VehicleInfo[ vehicleid ][ vColor2 ]  = cache_get_field_content_int( i, "v_color_2" );
         VehicleInfo[ vehicleid ][ vModel ] = cache_get_field_content_int( i, "v_model" );
         VehicleInfo[ vehicleid ][ vTeh ] = cache_get_field_content_int( i, "v_teh" );
         VehicleInfo[ vehicleid ][ vReg ] = cache_get_field_content_int( i, "v_reg" );
         VehicleInfo[ vehicleid ][ vRegVreme ] = cache_get_field_content_int( i, "v_reg_vreme" );
         cache_get_field_content( i, "v_tablice", VehicleInfo[ vehicleid ][ vTablice ], mSQL, 16 );
         VehicleInfo[ vehicleid ][ vGPS ] = cache_get_field_content_int( i, "v_gps" );
         VehicleInfo[ vehicleid ][ vOsiguranje ] = cache_get_field_content_int( i, "v_insurance" );
         VehicleInfo[ vehicleid ][ vLock ] = cache_get_field_content_int( i, "v_lock" );
         VehicleInfo[ vehicleid ][ vAlarm ] = cache_get_field_content_int( i, "v_alarm" );
         VehicleInfo[ vehicleid ][ vFuel ] = cache_get_field_content_int( i, "v_fuel" );
         VehicleInfo[ vehicleid ][ vFuelType ] = cache_get_field_content_int( i, "v_fuel_type" );
         VehicleInfo[ vehicleid ][ vNeon ] = cache_get_field_content_int( i, "v_neon" );
          VehicleInfo[ vehicleid ][ vTuned ] = cache_get_field_content_int( i, "v_tuned" );
         VehicleInfo[ vehicleid ][ vImobilizator ] = cache_get_field_content_int( i, "v_imobilizator" );
         VehicleInfo[ vehicleid ][ vSpoiler ] = cache_get_field_content_int( i, "v_spoiler" );
         VehicleInfo[ vehicleid ][ vHood ] = cache_get_field_content_int( i, "v_hood" );
         VehicleInfo[ vehicleid ][ vRoof ] = cache_get_field_content_int( i, "v_roof" );
         VehicleInfo[ vehicleid ][ vSkirt ] = cache_get_field_content_int( i, "v_skirt" );
         VehicleInfo[ vehicleid ][ vLamps ] = cache_get_field_content_int( i, "v_lamps" );
         VehicleInfo[ vehicleid ][ vNitro ] = cache_get_field_content_int( i, "v_nitro" );
         VehicleInfo[ vehicleid ][ vExhaust ] = cache_get_field_content_int( i, "v_exhaust" );
         VehicleInfo[ vehicleid ][ vWheels ] = cache_get_field_content_int( i, "v_wheels" );
         VehicleInfo[ vehicleid ][ vStereo ] = cache_get_field_content_int( i, "v_stereo" );
         VehicleInfo[ vehicleid ][ vHydraulics ] = cache_get_field_content_int( i, "v_hydraulics" );
         VehicleInfo[ vehicleid ][ vFrontBumper ] = cache_get_field_content_int( i, "v_front_bumper" );
         VehicleInfo[ vehicleid ][ vRearBumper ] = cache_get_field_content_int( i, "v_rear_bumper" );
         VehicleInfo[ vehicleid ][ vVents ] = cache_get_field_content_int( i, "v_vents" );
         VehicleInfo[ vehicleid ][ vPaintJob ] = cache_get_field_content_int( i, "v_paintjob" );
         VehicleInfo[ vehicleid ][ vDrugAmmount ][ 0 ] = cache_get_field_content_int( i, "v_drug_ammount_1" );
         VehicleInfo[ vehicleid ][ vDrugAmmount ][ 1 ] = cache_get_field_content_int( i, "v_drug_ammount_2" );
         VehicleInfo[ vehicleid ][ vDrugAmmount ][ 2 ] = cache_get_field_content_int( i, "v_drug_ammount_3" );
         VehicleInfo[ vehicleid ][ vDrugAmmount ][ 3 ] = cache_get_field_content_int( i, "v_drug_ammount_4" );
         VehicleInfo[ vehicleid ][ vDrugAmmount ][ 4 ] = cache_get_field_content_int( i, "v_drug_ammount_5" );
         VehicleInfo[ vehicleid ][ vDrugAmmount ][ 5 ] = cache_get_field_content_int( i, "v_drug_ammount_6" );
         VehicleInfo[ vehicleid ][ vMaterijali ] = cache_get_field_content_int( i, "v_mats" );
         VehicleInfo[ vehicleid ][ vMelee ] = cache_get_field_content_int( i, "v_weapon_melee" );
         VehicleInfo[ vehicleid ][ vWeap1 ] = cache_get_field_content_int( i, "v_weapon_slot_1" );
         VehicleInfo[ vehicleid ][ vAmmo1 ] = cache_get_field_content_int( i, "v_weapon_ammo_1" );
         VehicleInfo[ vehicleid ][ vWeap2 ] = cache_get_field_content_int( i, "v_weapon_slot_2" );
         VehicleInfo[ vehicleid ][ vAmmo2 ] = cache_get_field_content_int( i, "v_weapon_ammo_2" );
         VehicleInfo[ vehicleid ][ vGajbica ][ 0 ] = cache_get_field_content_int( i, "v_gajbica_slot_1" );
         VehicleInfo[ vehicleid ][ vGajbica ][ 1 ] = cache_get_field_content_int( i, "v_gajbica_slot_2" );
         VehicleInfo[ vehicleid ][ vGajbica ][ 2 ] = cache_get_field_content_int( i, "v_gajbica_slot_3" );
         VehicleInfo[ vehicleid ][ vGajbica ][ 3 ] = cache_get_field_content_int( i, "v_gajbica_slot_4" );
         VehicleInfo[ vehicleid ][ vGajbica ][ 4 ] = cache_get_field_content_int( i, "v_gajbica_slot_5" );
         VehicleInfo[ vehicleid ][ vGajbicaAmmount ][ 0 ] = cache_get_field_content_int( i, "v_gajbica_kolicina_1" );
         VehicleInfo[ vehicleid ][ vGajbicaAmmount ][ 1 ] = cache_get_field_content_int( i, "v_gajbica_kolicina_2" );
         VehicleInfo[ vehicleid ][ vGajbicaAmmount ][ 2 ] = cache_get_field_content_int( i, "v_gajbica_kolicina_3" );
         VehicleInfo[ vehicleid ][ vGajbicaAmmount ][ 3 ] = cache_get_field_content_int( i, "v_gajbica_kolicina_4" );
         VehicleInfo[ vehicleid ][ vGajbicaAmmount ][ 4 ] = cache_get_field_content_int( i, "v_gajbica_kolicina_5" );
         VehicleInfo[ vehicleid ][ vKilometri ] = cache_get_field_content_int( i, "v_kilometri" );
         VehicleInfo[ vehicleid ][ vMetri ] = cache_get_field_content_int( i, "v_metri" );
         VehicleInfo[ vehicleid ][ v_owner_id ] = -1;

         LinkVehicleToInterior( vehicleid, VehicleInfo[ vehicleid ][ vInterior ] );
           SetVehicleVirtualWorld( vehicleid, VehicleInfo[ vehicleid ][ vVirtualWorld ] );
         vCanDrive[ vehicleid ] = 1;

              VehicleInfo[ vehicleid ][ Validv3DText ] = false;
          if( VehicleInfo[ vehicleid ][ vFuelType ] == 0 )
         {
            if( Diesel( vehicleid ) ) VehicleInfo[ vehicleid ][ vFuelType ] = 1;
            else if( Gasoline( vehicleid ) ) VehicleInfo[ vehicleid ][ vFuelType ] = 2;
            else if( GasOil( vehicleid ) ) VehicleInfo[ vehicleid ][ vFuelType ] = 3;
         }

           SetVehicleParamsEx( vehicleid, 0, 0, 0, VehicleInfo[ vehicleid ][ vLocked ], 0, 0, 0 );
           if( IsVehicleBajs( vehicleid ) )
         {
            SetVehicleParamsEx( vehicleid, 1, 0, 0, VehicleInfo[ vehicleid ][ vLocked ], 0, 0, 0 );
         }
           ResetVehicleStatistics( vehicleid );
         VehicleInfo[ vehicleid ][ vFuel ] = getAmountFuel( vehicleid );

            if( VehicleInfo[ vehicleid ][ vUsage ] == PRIVATNO_VOZILO )
         {
              Fuel[ vehicleid ] = VehicleInfo[ vehicleid ][ vFuel ];
          }
         else if( VehicleInfo[ vehicleid ][ vUsage ] == POSLOVNO_VOZILO )
         {
             VehicleInfo[ vehicleid ][ vFuel ] = 100;
             Fuel[ vehicleid ] = 100;
         }
         else
         {
             Fuel[ vehicleid ] = getAmountFuel( vehicleid );
         }

         SetVehicleLabels( vehicleid );

         if( VehicleInfo[ vehicleid ][ vReg ] == 1 ) {
            SetTablice( vehicleid );
         }
         else if( VehicleInfo[ vehicleid ][ vReg ] == 2 ) {
            SetVehicleNumberPlate( vehicleid, VehicleInfo[ vehicleid ][ vTablice ] );
         }
         else  {
            SetVehicleNumberPlate( vehicleid, "NEMA" );
         }

         TuneVehicle( vehicleid );

            if( VehicleInfo[ vehicleid ][ vUsage ] == PUMPA_VOZILO ) {

                new fstationID = VehicleInfo[ vehicleid ][ vFuelStation ];

            if( VehicleInfo[ vehicleid ][ vModel ] == 584 ) {
               FuelStation[ fstationID ][ fsCisternID ] = vehicleid;
            }
            else if( VehicleInfo[ vehicleid ][ vModel ] == 403 ) {
               FuelStation[ fstationID ][ fsTruckID ] = vehicleid;
            }

         }

           #if ZIMSKI_MOD == 1
         if( VehicleInfo[ vehicleid ][ vUsage ] == POSLOVNO_VOZILO && VehicleInfo[ vehicleid ][ vJob ] == POSAO_KOMUNALAC && VehicleInfo[ vehicleid ][ vModel ] == 455 )
         {
             SnowObjects[ vehicleid ] = true;

             SnowObject1[ vehicleid ] = CreateDynamicObject( 19601, 0, 0, -1500, 0, 0, 0 );
            AttachDynamicObjectToVehicle( SnowObject1[ vehicleid ], vehicleid, 0.000000, 4.200001, -1.049999, 13.500000, 0.000000, 180.000 );

            SnowObject2[ vehicleid ] = CreateDynamicObject( 18646, 0, 0, -1500, 0, 0, 0 );
            AttachDynamicObjectToVehicle( SnowObject2[ vehicleid ], vehicleid, 0.749999, 1.575000, 1.725000, 0.000000, 0.000000, 0.000000 );
         }
         #endif

         if( playerid != 1001 )
         {
             SendInfoMessage( playerid, "Dodali ste vozilo %s sa aukcije, igracu %s za %d$.", GetVehicleNameEx( VehicleInfo[ vehicleid ][ vModel ] ), ImeIgraca( targetid ), moneyauc );

            new string[ 128 ];
                format( string, sizeof( string ), "AUKCIJA VOZILO SQLID: %d | Prodano igracu %s od admina %s ", VehicleInfo[ vehicleid ][ vSqlID ], ImeIgraca( targetid ), ImeIgraca( playerid ) );
            LogSave( "Logovi/LogAukcije.log", string );
         }

         if( targetid != 1001 && targetid != IPI )
         {
             for( new j = 0; j < MAX_VEH_SLOT; j ++ )
            {
                 if( (j+1) <= PlayerInfo[ targetid ][ xSlotoviVozila ] && player_veh[ targetid ][ vehicle_id ][ j ] == -1 )
               {
                  player_veh[ targetid ][ vehicle_id ][ j ] = vehicleid;
                  break;
               }
            }

            VehicleInfo[ vehicleid ][ v_owner_id ] = targetid;
            VehicleInfo[ vehicleid ][ vOwner_sqlID ] = PlayerInfo[ targetid ][ xID ];
            strmid( VehicleInfo[ vehicleid ][ vOwner ], ImeIgraca( targetid ), 0, strlen( ImeIgraca( targetid ) ), 32 );

                VehicleInfo[ vehicleid ][ vPrice ] = VehPrice[ VehicleInfo[ vehicleid ][ vModel ]- 400 ][ 1 ];

                new Float:plocx, Float:plocy, Float:plocz, Float:carangle;
            GetPlayerPos( targetid, plocx, plocy, plocz );
            mh_SetVehiclePos( vehicleid, plocx, plocy+4, plocz );
                GetVehicleZAngle( vehicleid, carangle );

                VehicleInfo[ vehicleid ][ vVirtualWorld ] = GetPlayerVirtualWorld( targetid );
            VehicleInfo[ vehicleid ][ vInterior ] = GetPlayerInterior( targetid );

            VehicleInfo[ vehicleid ][ vLokacijaX ] = plocx;
            VehicleInfo[ vehicleid ][ vLokacijaY ] = plocy;
            VehicleInfo[ vehicleid ][ vLokacijaZ ] = plocz;
            VehicleInfo[ vehicleid ][ vLokacijaA ] = carangle;

            LinkVehicleToInterior( vehicleid, VehicleInfo[ vehicleid ][ vInterior ] );
             SetVehicleVirtualWorld( vehicleid, VehicleInfo[ vehicleid ][ vVirtualWorld ] );

            new q[ 512 ];
            mysql_format( mSQL, q, sizeof(q), "UPDATE `vehicles` SET `owner_sqlID` = '%d', `v_price` = '%d', `v_pos_x` = '%f', `v_pos_y` = '%f', `v_pos_z` = '%f', `v_pos_a` = '%f', `v_virtualw` = '%d', `v_interior` = '%d' WHERE `veh_id` = '%d' LIMIT 1",
                              VehicleInfo[ vehicleid ][ vOwner_sqlID ],
                              VehicleInfo[ vehicleid ][ vPrice ],
                              VehicleInfo[ vehicleid ][ vLokacijaX ],
                              VehicleInfo[ vehicleid ][ vLokacijaY ],
                              VehicleInfo[ vehicleid ][ vLokacijaZ ],
                              VehicleInfo[ vehicleid ][ vLokacijaA ],
                              VehicleInfo[ vehicleid ][ vVirtualWorld ],
                              VehicleInfo[ vehicleid ][ vInterior ],
                              VehicleInfo[ vehicleid ][ vSqlID ] );

            mysql_tquery( mSQL, q );

            SendInfoMessage( targetid, "Dobili ste vozilo %s sa aukcije, od admina %s za %d$.", GetVehicleNameEx( VehicleInfo[ vehicleid ][ vModel ] ), ImeIgraca( playerid ), moneyauc );

            if( moneyauc != 0 ) DajIgracuNovac( targetid, -moneyauc );
         }
      }
   }
   else
   {
      if( playerid != 1001 ) SendInfoMessage( playerid, "Pogresan basesqlID(nepostoji)." );
   }
   return(true);
}[/pawn]

ah, dobri stari imperium

Mnogo imaš ti još da jedeš kačamak.
skrr
Moj tutorijali: Bazilion indent warninga
WORK? : Smart Project 1.2 , Leskovacki Detmec, Rodjendanski  server


Penzionisani balkanski samp kripter


Citat: (っâ—"â—¡â—")っ ♥ bunta ♥ poslato Jun 24, 2019, 18:46:25 POSLE PODNE
ah, dobri stari imperium

Mojne da skupljas postove (foto , video , ubuntu)  :D  :D :D




Give Honor To The One Who Deserve It





IZVINI MAMA STO LOMIM KLUBOVE KAD SLAVIM JAAA!!
XDDDDDDDDDDDDDDDDDDDDDDDDDDD

@tema
daj liniju 12325

Mnogo imaš ti još da jedeš kačamak.
skrr
Moj tutorijali: Bazilion indent warninga
WORK? : Smart Project 1.2 , Leskovacki Detmec, Rodjendanski  server


Penzionisani balkanski samp kripter


Citat: (っâ—"â—¡â—")っ ♥ bunta ♥ poslato Jun 24, 2019, 19:02:29 POSLE PODNE
IZVINI MAMA STO LOMIM KLUBOVE KAD SLAVIM JAAA!!
XDDDDDDDDDDDDDDDDDDDDDDDDDDD

@tema
daj liniju 12325
Eto[pawn]if( org_info[ VehicleInfo[ i ][ vOrganization ] ][ oTip ] == ORG_TIP_PD )[/pawn]

commentuj ceo if statement pa probaj

Mnogo imaš ti još da jedeš kačamak.
skrr
Moj tutorijali: Bazilion indent warninga
WORK? : Smart Project 1.2 , Leskovacki Detmec, Rodjendanski  server


Penzionisani balkanski samp kripter


primjer
[pawn]#define drss 3
new
   kaeha[drss];
public OnFilterScriptInit()
{
   for(new zz = -1; zz < drss; zz++)
   {
      kaeha[zz] = 69;
   }
   return 1;
}
[/pawn]
// taj gor kod sam ti postavio sam ti samo primjer zbog cega ti izbacuje u samp-server.exe / server_log.txt error da skontaš i malo popravi funkciju OnVehiclesLoad

da ne stavljam sliku sta bude kad se pokrene fs eo kod dole od server_log.txt / samp_server.exe
Citat[03:15:37]   Loading filterscript 'test.amx'...
[03:15:37] [debug] Run time error 4: "Array index out of bounds"
[03:15:37] [debug]  Attempted to read/write array element at negative index -1
[03:15:37] [debug] AMX backtrace:
[03:15:37] [debug] #0 00000088 in public OnFilterScriptInit () at D:\hazetest\filterscripts\test.pwn:10
69