Balkan SA:MP

PAWN skriptanje, gamemodovi, filterskripte, include fajlovi, mape, pluginovi => Razgovor u vezi PAWN - skriptanja => Temu započeo: xSpirit poslato Avgust 09, 2012, 13:18:27 POSLE PODNE

Naslov: [Pomoć] Auti
Poruka od: xSpirit poslato Avgust 09, 2012, 13:18:27 POSLE PODNE
Skripta koju koristim: Xomnia
Detaljan opis problema: Na xomnia serveru ovo je radilo pa neznam u čemu je problem... uglavnom, auti za prodaju se kreiraju IG te kada ih kreiram, napravim sve super radi.. meÄ'utim ukoliko dodam aute za poslove u skriptu, automatski se gorivo smanji na 0, cjena bude 0, kao i ovim autima za posao... a ako nema auti za prodaju, auti za poslove rade super.. (ovo sa autima za prodaju se deÅ¡ava, iako je u folderu Vehicles, odnosno u tim filovima sve uredu)
Dio skripte:
Kod (auta za posao) [Izaberi]
//--------------------------[ Product vans ]--------------------------------

ProductSellers[ 0 ] = AddStaticVehicleEx(413, 2309.2539, -166.5248, 26.9574, -90.0000, -1, -1, 10000);
ProductSellers[ 1 ] = AddStaticVehicleEx(413, 2309.3855, -160.5834, 26.9574, -90.0000, -1, -1, 10000);
ProductSellers[ 2 ] = AddStaticVehicleEx(413, 2309.2388, -154.9195, 26.9574, -90.0000, -1, -1, 10000);
ProductSellers[ 3 ] = AddStaticVehicleEx(413, 2309.2104, -148.5145, 26.9574, -90.0000, -1, -1, 10000);

//-------------------------[ Farm trailers ]-------------------------------

AddStaticVehicleEx(610, 1948.1283, 160.1488, 36.3844, -109.4401, -1, -1, 100);
AddStaticVehicleEx(610, 1947.3618, 157.9078, 36.3844, -109.4401, -1, -1, 100);
AddStaticVehicleEx(610, 1946.5903, 155.6254, 36.3844, -109.4401, -1, -1, 100);
AddStaticVehicleEx(610, 1945.7784, 153.3274, 36.3844, -109.4401, -1, -1, 100);

//-------------------------------------------------------------------------

FireTruck[ 0 ] = AddStaticVehicleEx(407, 2321.4617, -228.7335, 27.1344, 90.0000, -1, -1, 100);
FireTruck[ 1 ] = AddStaticVehicleEx(407, 2321.3157, -234.0623, 27.1344, 90.0000, -1, -1, 100);
FireTruck[ 2 ] = AddStaticVehicleEx(407, 2321.4558, -239.6780, 27.1344, 90.0000, -1, -1, 100);

//-------------------------------------------------------------------------

CopCars[ 0 ] = AddStaticVehicleEx(599,2467.0010,139.6215,27.5697,1.5714,0,1, 15000); // Ranger1
CopCars[ 1 ] = AddStaticVehicleEx(599,2462.8459,139.5494,27.5696,179.9530,0,1, 15000); // Ranger2
CopCars[ 2 ] = AddStaticVehicleEx(597,2472.6716,138.8708,27.1506,1.6576,0,1, 15000); // SF1
CopCars[ 3 ] = AddStaticVehicleEx(598,2458.1714,131.9063,27.0650,179.2539,0,1, 15000); // LV1

//-------------------------------------------------------------------------

TrashMaster[ 0 ] = AddStaticVehicleEx(408,2463.2559,-41.5989,27.0312,180.8247,26,26, 450); //
TrashMaster[ 1 ] = AddStaticVehicleEx(408,2457.6404,-42.4161,27.0324,357.9941,26,26, 450); //

for( new t = 0; t < sizeof( TrashMaster ); t++ ) VehicleInfo[ TrashMaster[ t ] ][ vehCreated ] = 0;

//-------------------------------------------------------------------------

Boxville = AddStaticVehicleEx(498, 2263.0657, 61.0435, 26.5557, 90.0000, -1, -1, 100);
VehicleInfo[ Boxville ][ vehCreated ] = 0;

SetVehicleParamsEx( Boxville, 0, 0, 0, 0, 0, 0, 0 );


ovo je pod OnGameModeInit za učitavanje autiju (ne ovih za posao nego svih ostalih)

Kod (load vehicles()  ) [Izaberi]
LoadVehicles() {

    new filename[ 32 ],
    Data[ 256 ],
Count = 0,
    Cunt = GetTickCount();

for( new i = 1; i < MAX_CO_VEHICLES; i++ ) {

if( i >= GetFreeVehicleSlot() ) break;

format( filename, sizeof( filename ), VEHICLE_FILE_PATH "Vehicle_%d.ini", i );

if( fexist( filename )) {

    new File: vehFile = fopen( filename, io_read );
   
            while ( fread( vehFile , Data , sizeof( Data ) ) ) {

            if( strcmp( ini_GetKey( Data ) , "Status" , true ) == 0 ) { VehicleInfo[ i ][ vehCreated ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "ID" , true ) == 0 ) { VehicleInfo[ i ][ vehID ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Model" , true ) == 0 ) { VehicleInfo[ i ][ vehModel ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Cijena" , true ) == 0 ) { VehicleInfo[ i ][ vehPrice ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Boja1" , true ) == 0 ) { VehicleInfo[ i ][ vehCol1 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Boja2" , true ) == 0 ) { VehicleInfo[ i ][ vehCol2 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Vrata" , true ) == 0 ) { VehicleInfo[ i ][ vehDoors ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "ElektricnaBrava" , true ) == 0 ) { VehicleInfo[ i ][ vehAntiTheft ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "PaintJob" , true ) == 0 ) { VehicleInfo[ i ][ vehPaintJob ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Gorivo" , true ) == 0 ) { VehicleInfo[ i ][ vehFuel ] = floatstr( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "X" , true ) == 0 ) { VehicleInfo[ i ][ vehX ] = floatstr( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Y" , true ) == 0 ) { VehicleInfo[ i ][ vehY ] = floatstr( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Z" , true ) == 0 ) { VehicleInfo[ i ][ vehZ ] = floatstr( ini_GetValue ( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Angle" , true ) == 0 ) { VehicleInfo[ i ][ vehA ] = floatstr( ini_GetValue ( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Kilometara" , true ) == 0 ) { VehicleInfo[ i ][ vehD ] = floatstr( ini_GetValue ( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "ZadnjiServis" , true ) == 0 ) { VehicleInfo[ i ][ vehLastService ] = floatstr( ini_GetValue ( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "RepairReload" , true ) == 0 ) { VehicleInfo[ i ][ vehRepairReload ] = strval( ini_GetValue( Data ) ); }
   
    if( strcmp( ini_GetKey( Data ) , "Energija" , true ) == 0 ) { VehicleInfo[ i ][ vehHealth ] = floatstr( ini_GetValue ( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Panels" , true ) == 0 ) { VehicleDamage[ i ][ 0 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Doors" , true ) == 0 ) { VehicleDamage[ i ][ 1 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Lights" , true ) == 0 ) { VehicleDamage[ i ][ 2 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Tires" , true ) == 0 ) { VehicleDamage[ i ][ 3 ] = strval( ini_GetValue( Data ) ); }
   
    if( strcmp( ini_GetKey( Data ) , "Mod0" , true ) == 0 ) { VehicleMods[ i ][ 0 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Mod1" , true ) == 0 ) { VehicleMods[ i ][ 1 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Mod2" , true ) == 0 ) { VehicleMods[ i ][ 2 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Mod3" , true ) == 0 ) { VehicleMods[ i ][ 3 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Mod4" , true ) == 0 ) { VehicleMods[ i ][ 4 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Mod5" , true ) == 0 ) { VehicleMods[ i ][ 5 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Mod6" , true ) == 0 ) { VehicleMods[ i ][ 6 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Mod7" , true ) == 0 ) { VehicleMods[ i ][ 7 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Mod8" , true ) == 0 ) { VehicleMods[ i ][ 8 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Mod9" , true ) == 0 ) { VehicleMods[ i ][ 9 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Mod10" , true ) == 0 ) { VehicleMods[ i ][ 10 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Mod11" , true ) == 0 ) { VehicleMods[ i ][ 11 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Mod12" , true ) == 0 ) { VehicleMods[ i ][ 12 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Mod13" , true ) == 0 ) { VehicleMods[ i ][ 13 ] = strval( ini_GetValue( Data ) ); }
   
    if( strcmp( ini_GetKey( Data ) , "Oruzje1" , true ) == 0 ) { VehicleWeapon[ i ][ 0 ][ 0 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Oruzje1Metaka" , true ) == 0 ) { VehicleWeapon[ i ][ 0 ][ 1 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Oruzje2" , true ) == 0 ) { VehicleWeapon[ i ][ 1 ][ 0 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Oruzje2Metaka" , true ) == 0 ) { VehicleWeapon[ i ][ 1 ][ 1 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Oruzje3" , true ) == 0 ) { VehicleWeapon[ i ][ 2 ][ 0 ] = strval( ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Oruzje3Metaka" , true ) == 0 ) { VehicleWeapon[ i ][ 2 ][ 1 ] = strval( ini_GetValue( Data ) ); }
   
    if( strcmp( ini_GetKey( Data ) , "Registracija" , true ) == 0 ) { format( VehicleInfo[ i ][ vehReg ], strlen( ini_GetValue ( Data ) ), "%s", ini_GetValue( Data ) ); }
    if( strcmp( ini_GetKey( Data ) , "Vlasnik" , true ) == 0 ) { format( VehicleInfo[ i ][ vehOwner ], strlen( ini_GetValue ( Data ) ), "%s", ini_GetValue( Data ) ); }
}

fclose( vehFile ), Count++;

VehicleInfo[ i ][ vehID ] = CreateVehicle( VehicleInfo[ i ][ vehModel ], VehicleInfo[ i ][ vehX ], VehicleInfo[ i ][ vehY ], VehicleInfo[ i ][ vehZ ], VehicleInfo[ i ][ vehA ], VehicleInfo[ i ][ vehCol1 ], VehicleInfo[ i ][ vehCol2 ], DEFAULT_RESPAWN_DELAY );
VehicleInfo[ VehicleInfo[ i ][ vehID ] ][ vehCreated ] = 1;

SetVehicleHealth( VehicleInfo[ i ][ vehID ], VehicleInfo[ i ][ vehHealth ] );
UpdateVehicleDamageStatus( VehicleInfo[ i ][ vehID ], VehicleDamage[ i ][ 0 ], VehicleDamage[ i ][ 1 ], VehicleDamage[ i ][ 2 ], VehicleDamage[ i ][ 3 ] );

SetVehicleHealth( i, VehicleInfo[ i ][ vehHealth ] );

for( new Mods = 0; Mods < MAX_CAR_MODS; Mods++ ) AddVehicleComponent( i, VehicleMods[ i ][ Mods ] ); //Tune the vehicle

if( VehicleInfo[ i ][ vehPaintJob ] != 255 ) ChangeVehiclePaintjob( i, VehicleInfo[ i ][ vehPaintJob ] ); //Change the paintjob

new engine, lights, alarm, doors, bonnet, boot, objective;

GetVehicleParamsEx( i, engine, lights, alarm, doors, bonnet, boot, objective );
SetVehicleParamsEx( i, engine, lights, alarm, VehicleInfo[ i ][ vehDoors ], bonnet, boot, objective ); //Lock/Unlock the vehicle

SetVehicleNumberPlate( i, VehicleInfo[ i ][ vehReg ] );

ServerCar[ i ][ Fuel ] = VehicleInfo[ i ][ vehFuel ];

#if USE_VEHICLE_LABEL == true

if( IsAShopVehicle( i ) ) {

new CarInfo[ 128 ];

format( CarInfo, sizeof( CarInfo ), "Prodaje se %s!\nCijena: $%d", VehicleNames[ VehicleInfo[ i ][ vehModel ] - 400 ], VehicleInfo[ i ][ vehPrice ] );
VehicleLabel[ i ] = Create3DTextLabel( CarInfo, WHITE, 0.0, 0.0, 0.0, VEHICLE_LABEL_DRAW_DISTANCE, 0, 0 );
Attach3DTextLabelToVehicle( VehicleLabel[ i ], i, 0.0, 0.0, 0.0 );
}

#endif

}
else break;
}
LoadTime += GetTickCount() - Cunt;
print( "=========[ Sistem vozila ]========" );
printf("Loadano %d vozila u %d milisekunde!|", Count, GetTickCount() - Cunt);
print( "==================================" );
return true;
}

Neke slike/video za lakse dobivanje pomoci(neobavezno): //
Naslov: Odg: [Pomoć] Auti
Poruka od: xSpirit poslato Avgust 10, 2012, 16:19:49 POSLE PODNE
refresh, zna iko.. prošlo je više od 24h...