[MySQL] Loading Vehicles
#1

Hey guys, I'm currently scripting a MySQL RP GM but I've had a bit of trouble.

I've managed to setup the table for the vehicles and the first one loads up fine but the others don't seem to load. Here is my "LoadCars" function:

pawn Код:
public LoadCar()
{
  new DataString[ 128 ], Query[ 128 ], idx;
 
    format( Query, sizeof( Query ), "SELECT * FROM `Vehicles`");
    mysql_query( Query );
    mysql_store_result();
   
    mysql_fetch_field( "CarID", DataString );
    DynamicCars[ idx ][ CarID ] = strval( DataString );
   
    mysql_fetch_field( "CarModel", DataString );
    DynamicCars[ idx ][ CarModel ] = strval( DataString );
   
    mysql_fetch_field( "CarX", DataString );
    DynamicCars[ idx ][ CarX ] = strval( DataString );
   
    mysql_fetch_field( "CarY", DataString );
    DynamicCars[ idx ][ CarY ] = strval( DataString );
   
    mysql_fetch_field( "CarZ", DataString );
    DynamicCars[ idx ][ CarZ ] = strval( DataString );
   
    mysql_fetch_field( "CarAngle", DataString );
    DynamicCars[ idx ][ CarAngle ] = strval( DataString );
   
    mysql_fetch_field( "CarColor1", DataString );
    DynamicCars[ idx ][ CarColor1 ] = strval( DataString );
   
    mysql_fetch_field( "CarColor2", DataString );
    DynamicCars[ idx ][ CarColor2 ] = strval( DataString );
   
    mysql_fetch_field( "FactionCar", DataString );
    DynamicCars[ idx ][ FactionCar ] = strval( DataString );
   
    mysql_fetch_field( "CarType", DataString );
    DynamicCars[ idx ][ CarType ] = strval( DataString );
   
    mysql_free_result();
   
    CreateVehicle(DynamicCars[idx][CarModel],DynamicCars[idx][CarX],DynamicCars[idx][CarY],DynamicCars[idx][CarZ],DynamicCars[idx][CarAngle],DynamicCars[idx][CarColor1],DynamicCars[idx][CarColor2], -1);

    return 1;
}
What am I doing wrong?

- Samdudes
Reply


Messages In This Thread
[MySQL] Loading Vehicles - by Agent Smith - 05.05.2010, 19:39
Re: [MySQL] Loading Vehicles - by woot - 05.05.2010, 20:56
Re: [MySQL] Loading Vehicles - by Agent Smith - 05.05.2010, 21:10
Re: [MySQL] Loading Vehicles - by Calgon - 05.05.2010, 21:12
Re: [MySQL] Loading Vehicles - by Agent Smith - 05.05.2010, 21:14

Forum Jump:


Users browsing this thread: 1 Guest(s)