Vehicle loading problem
#1

Hi,

I made the vehicle system for factions but the problem is that the vehicles won't load, they save perfectly but the loading part it doesn't, here is the code:

pawn Код:
stock LoadVehicles()
{
    new string[128];
    new VehicleID, VehicleModel, Float:VehicleX, Float:VehicleY, Float:VehicleZ, Float:VehicleA, Col1, Col2, Fac, i = 0;

    mysql_query("SELECT * FROM `vehicledata`");
    mysql_store_result();
    if(mysql_num_rows() != 0)
    {
        while(mysql_fetch_row(string))
        {
            sscanf(string, "p<|>ddffffddd", VehicleID, VehicleModel, VehicleX, VehicleY, VehicleZ, VehicleA, Col1, Col2, Fac);

            CreateVehicle(VehicleModel, VehicleX, VehicleY, VehicleZ, VehicleA, Col1, Col2, 900000000000, 1);
            vInfo[i][Faction] = Fac;
            vInfo[i][Owned] = 0;
            vInfo[i][VehID] = VehicleID;
            i++;
        }
    }
    mysql_free_result();
    printf("--- %i vehicles loaded from the database. ---");
    return 1;
}
Reply
#2

Код:
stock LoadVehicles()
{
	new string[128];
	new VehicleID, VehicleModel, Float:VehicleX, Float:VehicleY, Float:VehicleZ, Float:VehicleA, Col1, Col2, Fac, i = 0;

	new Query = mysql_query("SELECT * FROM `vehicledata`");
	mysql_store_result();
	if(mysql_num_rows() != 0)
	{
	     while(mysql_fetch_row_format(Query, "|"))
	    {

               mysql_fetch_field_row(i, "Column Name");
               Variable = strval(i);

          And So on..


	        CreateVehicle(VehicleModel, VehicleX, VehicleY, VehicleZ, VehicleA, Col1, Col2, 900000000000, 1);
	        vInfo[i][Faction] = Fac;
	        vInfo[i][Owned] = 0;
	        vInfo[i][VehID] = VehicleID;
	        i++;
	    }
	}
	mysql_free_result();
	printf("--- %i vehicles loaded from the database. ---");
	return 1;
}
Try this, Anyway use the updated MySQL version, Its out of date now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)