MYSQL Vehicles
#1

Having a little bit of an issue with my saving and loading of my cars in my mysql database. The cars are getting added as they should be. Vehicleid's start with id 0 in the database, when they should start with id 1.

PHP код:
forward loadStaticVehicles();
public 
loadStaticVehicles()
{
    static 
rows,fields;
    
cache_get_data(rowsfieldsdbHandle);
    
StaticVehicleRows rows;
    
printf("\nStatic Vehicle Amount:%d",StaticVehicleRows);
    for (new 
0StaticVehicleRows++)
    {
        
StaticCars[i][sMysqlId] = cache_get_field_content_int(i"StaticMysqlId");
          
StaticCars[StaticCars[i][sMysqlId]][scX] = cache_get_field_content_float(i"StaticVehicleX");
        
StaticCars[StaticCars[i][sMysqlId]][scY] = cache_get_field_content_float(i"StaticVehicleY");
        
StaticCars[StaticCars[i][sMysqlId]][scZ] = cache_get_field_content_float(i"StaticVehicleZ");
        
StaticCars[StaticCars[i][sMysqlId]][scA] = cache_get_field_content_float(i"StaticAngle");
        
StaticCars[StaticCars[i][sMysqlId]][sColor1] = cache_get_field_content_int(i"StaticColor1");
        
StaticCars[StaticCars[i][sMysqlId]][sColor2] = cache_get_field_content_int(i"StaticColor2");
        
StaticCars[StaticCars[i][sMysqlId]][sCclass] = cache_get_field_content_int(i"StaticClass");
        
StaticCars[StaticCars[i][sMysqlId]][sLock] = cache_get_field_content_int(i"StaticLock");
        
StaticCars[StaticCars[i][sMysqlId]][sEngine] = cache_get_field_content_int(i"StaticEngine");
        
StaticCars[StaticCars[i][sMysqlId]][sLights] = cache_get_field_content_int(i"StaticLights");
        
StaticCars[StaticCars[i][sMysqlId]][sDamage] = cache_get_field_content_float(i"StaticDamage");
        
StaticCars[StaticCars[i][sMysqlId]][sFuel] = cache_get_field_content_int(i"StaticFuel");
        
StaticCars[StaticCars[i][sMysqlId]][sMiles] = cache_get_field_content_float(i"StaticMiles");
        
StaticCars[StaticCars[i][sMysqlId]][sKmh] = cache_get_field_content_float(i"StaticKMH");
        
StaticCars[StaticCars[i][sMysqlId]][sKnots] = cache_get_field_content_float(i"StaticKnots");
         
StaticCars[StaticCars[i][sMysqlId]][sSlots] = cache_get_field_content_int(i"StaticSlots");
        
cache_get_field_content(i"StaticStorage"StaticCars[StaticCars[i][sMysqlId]][sStorage], dbHandle,128);
        
StaticCars[StaticCars[i][sMysqlId]][sModel] = cache_get_field_content_int(i"StaticModel");
        
StaticCars[StaticCars[i][sMysqlId]][staticVehicleId] = AddStaticVehicleEx(StaticCars[StaticCars[i][sMysqlId]][sModel],StaticCars[StaticCars[i][sMysqlId]][scX],StaticCars[StaticCars[i][sMysqlId]][scY],StaticCars[StaticCars[i][sMysqlId]][scZ],StaticCars[StaticCars[i][sMysqlId]][scA],StaticCars[StaticCars[i][sMysqlId]][sColor1],StaticCars[StaticCars[i][sMysqlId]][sColor2],-1,0);
        return 
1;

PHP код:
forward SaveStaticVehicles(vehicleid);
public 
SaveStaticVehicles(vehicleid)
{
    
format(Querysizeof(Query), "UPDATE staticvehicles SET StaticVehicleId = %d, StaticEngine = %d, StaticLights = %d, StaticMiles = '%.1f', StaticKMH = '%.1f', StaticKnots = '%.1f' WHERE StaticMysqlId = %d",
    
vehicleid,
    
StaticCars[vehicleid][sEngine],
    
StaticCars[vehicleid][sLights],
    
StaticCars[vehicleid][sMiles],
    
StaticCars[vehicleid][sKmh],
    
StaticCars[vehicleid][sKnots],
    
StaticCars[vehicleid][sMysqlId]);
    
mysql_query(dbHandleQueryfalse);
    
printf("%d",vehicleid);
    return 
1;

Reply


Messages In This Thread
MYSQL Vehicles - by ihatetn931 - 17.08.2015, 21:14
Re: MYSQL Vehicles - by ihatetn931 - 18.08.2015, 21:06
Re: MYSQL Vehicles - by Stev - 18.08.2015, 21:09
Re: MYSQL Vehicles - by ihatetn931 - 18.08.2015, 21:19
Re: MYSQL Vehicles - by ihatetn931 - 20.08.2015, 16:31

Forum Jump:


Users browsing this thread: 1 Guest(s)