Faction vehicles. [MySQL]
#1

When I dynamicly add faction vehicles to a certain faction IG everything is fine. However once I restart the server some of the faction vehicles suddenly appear in different factions even though everything appears to be fine in the database.

Here is my MySQL database and my script for it...

http://puu.sh/4G3zR.png

Код:
    mysql_query("SELECT * FROM `Vehicles`");
    mysql_store_result();
    new i = 1;
    if(mysql_num_rows() > 0)
    {
        while(mysql_fetch_row(Str))
        {
            sscanf(Str, "p<|>iiffffiii", vID, dModel, VX, VY, VZ, VA, col1, col2, faction);
            CreateVehicle(dModel, VX, VY, VZ, VA, col1, col2, -1);
            VehicleFaction[i] = faction;
            new str[9];
			new rand[7];
			rand[0] = random(sizeof(letters));
			rand[1] = random(sizeof(letters));
			rand[2] = random(sizeof(nums));
			rand[3] = random(sizeof(nums));
			rand[4] = random(sizeof(letters));
			rand[5] = random(sizeof(letters));
			rand[6] = random(sizeof(letters));
			format(str, sizeof(str), "%s%s%d%d %s%s%s", letters[rand[0]], letters[rand[1]], nums[rand[2]], nums[rand[3]], letters[rand[4]], letters[rand[5]], letters[rand[6]]);
			//SetVehicleNumberPlate(i, str);
			SetVehicleToRespawn(i);
            i++;
			vTotal++;
		}
    }
    mysql_free_result();
    printf("%i vehicles loaded from the MySQL Database.", vTotal);
	return 1;
}
Reply
#2

You are assigning VehicleFaction var to the wrong vehicleid. Any vehicle created before this will conflict with that code.
pawn Код:
new vehicle = CreateVehicle(...
VehicleFaction [vehicle] = faction;
Reply
#3

This didn't seem to work although I think I've worked a way around this.. Thanks anyway!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)