23.12.2012, 17:58
Bump.
I've been debugging the code aswell as working with SSCANF.
This what I have and it keeps telling me that I have a buffer overflow when I add a size to the S variable.
For the post above the S variable signifies the vehicle owners name and the D at the end of the SSCANF is the carid that comes out once the vehicle has been spawned, the owners name is in the database but the carid isn't as it's dynamic, though it's in the enum. I would really love to see this fixed and behind me. Thankyou all for the support so far. Aswell as the vehicles aswell are still not spawning.
I've been debugging the code aswell as working with SSCANF.
PHP Code:
stock LoadPlayerVehicles(playerid)
{
new query[400];
format(query, sizeof(query), "SELECT * FROM `playervehicles` WHERE `OwnerName` = '%s'", PlayerName(playerid));
mysql_query(query);
mysql_store_result();
new i;
while(i < MAX_PLAYER_OWNED_CARS && mysql_retrieve_row())
{
mysql_fetch_row_format(query);
sscanf(query, "e<p<|>s[25]dffffdddddddddddddddddddddddddddddddddddd{d}>", PlayerOwnedVehicles[playerid][i]);
PlayerOwnedVehicles[playerid][i][pCarID] = CreateVehicle(PlayerOwnedVehicles[playerid][i][pCarModel], PlayerOwnedVehicles[playerid][i][pCarX], PlayerOwnedVehicles[playerid][i][pCarY], PlayerOwnedVehicles[playerid][i][pCarZ], PlayerOwnedVehicles[playerid][i][pCarRot], PlayerOwnedVehicles[playerid][i][pCarColor1], PlayerOwnedVehicles[playerid][i][pCarColor2], -1);
AddVehicleMods(playerid, i);
i++;
}
mysql_free_result();
return true;
}
For the post above the S variable signifies the vehicle owners name and the D at the end of the SSCANF is the carid that comes out once the vehicle has been spawned, the owners name is in the database but the carid isn't as it's dynamic, though it's in the enum. I would really love to see this fixed and behind me. Thankyou all for the support so far. Aswell as the vehicles aswell are still not spawning.