I keep getting string buffer overflow. Even with 600 cells it's possible, with the code you sent me.
pawn Code:
stock LoadPlayerVehicles(playerid)
{
new query[600];
format(query, sizeof(query), "SELECT * FROM `playervehicles` WHERE `Name` = '%s'", PlayerName(playerid));
mysql_query(query);
mysql_store_result();
new i;
if(mysql_num_rows() != 0)
{
while(i < MAX_PLAYER_OWNED_CARS && mysql_num_rows())
{
mysql_fetch_row_format(query);
sscanf(query, "p<|>s[24]dffffdddddddddddddddddddddddddddddddddddd",
PlayerOwnedVehicles[playerid][i][playerCarOwner],
PlayerOwnedVehicles[playerid][i][playerCarModel],
PlayerOwnedVehicles[playerid][i][playerCarX],
PlayerOwnedVehicles[playerid][i][playerCarY],
PlayerOwnedVehicles[playerid][i][playerCarZ],
PlayerOwnedVehicles[playerid][i][playerCarRot],
PlayerOwnedVehicles[playerid][i][playerCarColor1],
PlayerOwnedVehicles[playerid][i][playerCarColor2],
PlayerOwnedVehicles[playerid][i][playerCarPaintjob],
PlayerOwnedVehicles[playerid][i][playerCarMod1],
PlayerOwnedVehicles[playerid][i][playerCarMod2],
PlayerOwnedVehicles[playerid][i][playerCarMod3],
PlayerOwnedVehicles[playerid][i][playerCarMod4],
PlayerOwnedVehicles[playerid][i][playerCarMod5],
PlayerOwnedVehicles[playerid][i][playerCarMod6],
PlayerOwnedVehicles[playerid][i][playerCarMod7],
PlayerOwnedVehicles[playerid][i][playerCarMod8],
PlayerOwnedVehicles[playerid][i][playerCarMod9],
PlayerOwnedVehicles[playerid][i][playerCarMod10],
PlayerOwnedVehicles[playerid][i][playerCarMod11],
PlayerOwnedVehicles[playerid][i][playerCarMod12],
PlayerOwnedVehicles[playerid][i][playerCarMod13],
PlayerOwnedVehicles[playerid][i][playerCarMod14],
PlayerOwnedVehicles[playerid][i][playerCarMod15],
PlayerOwnedVehicles[playerid][i][playerCarMod16],
PlayerOwnedVehicles[playerid][i][playerCarMod17],
PlayerOwnedVehicles[playerid][i][playerCarHasLock],
PlayerOwnedVehicles[playerid][i][playerCarLocked],
PlayerOwnedVehicles[playerid][i][playerCarTrunkCash],
PlayerOwnedVehicles[playerid][i][playerCarTrunkGun1],
PlayerOwnedVehicles[playerid][i][playerCarTrunkGun2],
PlayerOwnedVehicles[playerid][i][playerCarTrunkGun3],
PlayerOwnedVehicles[playerid][i][playerCarTrunkGun4],
PlayerOwnedVehicles[playerid][i][playerCarTrunkAmmo1],
PlayerOwnedVehicles[playerid][i][playerCarTrunkAmmo2],
PlayerOwnedVehicles[playerid][i][playerCarTrunkAmmo3],
PlayerOwnedVehicles[playerid][i][playerCarTrunkAmmo4],
PlayerOwnedVehicles[playerid][i][playerCarSpawned],
PlayerOwnedVehicles[playerid][i][playerCarOwned],
PlayerOwnedVehicles[playerid][i][playerCarOwnerID],
PlayerOwnedVehicles[playerid][i][playerCarFuel],
PlayerOwnedVehicles[playerid][i][playerCarSlotID]
);
PlayerOwnedVehicles[playerid][i][playerCarID] = CreateVehicle(PlayerOwnedVehicles[playerid][i][playerCarModel], PlayerOwnedVehicles[playerid][i][playerCarX], PlayerOwnedVehicles[playerid][i][playerCarY], PlayerOwnedVehicles[playerid][i][playerCarZ], PlayerOwnedVehicles[playerid][i][playerCarRot], PlayerOwnedVehicles[playerid][i][playerCarColor1], PlayerOwnedVehicles[playerid][i][playerCarColor2], -1);
AddVehicleMods(playerid, i);
i++;
}
}
mysql_free_result();
return true;
}
This is the only code that's managed to spawn the vehicles I know i'm loading them through
mysql_num_rows as it should be
mysql_retrieve_row but this is the closest i've been to spawning vehicles and having it working. Though it spams 4 vehicles of the same kind. I'm not saying leave it like that but it must be a good thing. The [i] is used to get the vehicle slot id. MAX_PLAYER_OWNED_VEHICLES 2 would be slot 2 for the player. I'm trying to do it like that, thankyou all for your help again so far.