Not reading from MySQL?
#1

Hello there SA:MP community,

I have been continuing to develop my own script, and am having issues spawning in vehicles and getting their color's set (the vehicles themselves spawn in), but the colors do not. The colors are saving into the database. After debugging a bit, I have found out it is not retrieving the data for the colors, however I have it in there. Here is the script I use to initiate vehicles:
pawn Код:
forward initiateVehicles();
public initiateVehicles()
{
    mysql_query("SELECT * FROM vehicles");
    mysql_store_result();
    new x;
    while(mysql_retrieve_row())
    {
        mysql_get_field("vehicleID", result);
        x = strval(result);
        mysql_get_field("vehicleModelID", result);
        vInfo[x][vVehicleModelID] = strval(result);
        mysql_get_field("vehiclePosX", result);
        vInfo[x][vVehiclePosition][0] = floatstr(result);
        mysql_get_field("vehiclePosY", result);
        vInfo[x][vVehiclePosition][1] = floatstr(result);
        mysql_get_field("vehiclePosZ", result);
        vInfo[x][vVehiclePosition][2] = floatstr(result);
        mysql_get_field("VehiclePosRotation", result);
        vInfo[x][vVehicleRotation] = floatstr(result);
        mysql_get_field("vehicleGasoline", result);
        vInfo[x][vGasoline] = floatstr(result);
        mysql_get_field("vehicleFaction", result);
        vInfo[x][vVehicleFaction] = strval(result);
        mysql_get_field("vehicleGasoline", result);
        vInfo[x][vGasoline] = floatstr(result);
        mysql_get_field("vehicleCol1", result);
        vInfo[x][vVehicleColour][0] = strval(result);
        mysql_get_field("vehicleCol2", result);
        vInfo[x][vVehicleColour][1] = strval(result);
        printf("Vehicle color suppose to be %d and %d", vInfo[x][vVehicleColour][0], vInfo[x][vVehicleColour][1]);
        switch(vInfo[x][vVehicleModelID])
        {
            case 427, 428, 432, 601, 528: SetVehicleHealth(vInfo[x][vVehicleScriptID], 5000.0);
        }
        //printf("Loaded the %s (ID: %d) successfully.", VehicleNames[400 - x], x);
        vInfo[x][vVehicleScriptID] = CreateVehicle(vInfo[x][vVehicleModelID], vInfo[x][vVehiclePosition][0], vInfo[x][vVehiclePosition][1], vInfo[x][vVehiclePosition][2], vInfo[x][vVehicleRotation], vInfo[x][vVehicleColour][0], vInfo[x][vVehicleColour][1], 60000);
        SetVehicleZAngle(x, vInfo[x][vVehicleRotation]);
    }
    mysql_free_result();
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)