stock LoadPlayerVehicles(playerid)
{
new str[256];
new query[128];
for (new i = 1; i < MAX_PLAYER_OWNED_CARS + 1; i += 1)
{
format(query, sizeof(query), "SELECT * FROM `playervehicles` WHERE `OwnerName` = '%s' AND `VehicleSlot` = '%d'", PlayerName(playerid), i);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows())
{
sscanf(str, "p<|>e<sdffffdddddddddddddddddddddddddddddddddddd>", 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);
}
mysql_free_result();
}
return true;
}
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;
whie(i < MAX_PLAYER_OWNED_CARS && mysql_retrieve_row())
{
mysql_fetch_row(query);
sscanf(query, "p<|>e<sdffffdddddddddddddddddddddddddddddddddddd>", 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;
}
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;
}
enum PlayerCarData
{
playerCarOwner[MAX_PLAYER_NAME],
playerCarModel,
Float:playerCarX,
Float:playerCarY,
Float:playerCarZ,
Float:playerCarRot,
playerCarColor1,
playerCarColor2,
playerCarPaintjob,
playerCarMod1,
playerCarMod2,
playerCarMod3,
playerCarMod4,
playerCarMod5,
playerCarMod6,
playerCarMod7,
playerCarMod8,
playerCarMod9,
playerCarMod10,
playerCarMod11,
playerCarMod12,
playerCarMod13,
playerCarMod14,
playerCarMod15,
playerCarMod16,
playerCarMod17,
playerCarHasLock,
playerCarLocked,
playerCarTrunkCash,
playerCarTrunkGun1,
playerCarTrunkGun2,
playerCarTrunkGun3,
playerCarTrunkGun4,
playerCarTrunkAmmo1,
playerCarTrunkAmmo2,
playerCarTrunkAmmo3,
playerCarTrunkAmmo4,
playerCarSpawned,
playerCarOwned,
playerCarOwnerID,
playerCarFuel,
pSlotID,
playerCarID,
};
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, "p<|>s[" #MAX_PLAYER_NAME "]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][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;
}
PlayerOwnedVehicles[playerid][i][playerCarID] = 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);
new PlayerOwnedVehicles[MAX_PLAYERS][MAX_PLAYER_OWNED_VEHICLES +1][PlayerCarData];
#define MAX_PLAYER_OWNED_VEHICLES 4
It's defined by
PHP Code:
|
I fixed the error, thankyou for your help, time to see if the system actually works. It wasn't the fact that I had +1.. somehow there was just something different on that line so I fixed it with a backup I had had of that line.
Edit: Still getting "String Buffer Overflow". |
sscanf warning: Invalid data length. sscanf warning: Invalid character in data length. sscanf warning: String buffer overflow.
I'm getting it printed through the console. I'm thinking it's the S integer in the sscanf string.
"S[24]" - That's getting the players name of the car. I've tried changing it to [MAX_PLAYER_NAME] - That then gives me a different warning of all three: Code:
sscanf warning: Invalid data length. sscanf warning: Invalid character in data length. sscanf warning: String buffer overflow. |