15.09.2014, 19:49
(
Последний раз редактировалось SPA; 15.09.2014 в 20:56.
)
Код:
[21:38:27] [debug] Run time error 4: "Array index out of bounds" [21:38:27] [debug] Accessing element at index 65535 past array upper bound 1999 [21:38:27] [debug] AMX backtrace: [21:38:27] [debug] #0 000174fc in HouseFile_Save (HouseID=23) at C:\Users\MaHdy\Desktop\HouseSystem.pwn:2564 [21:38:27] [debug] #1 00007ecc in public Streamer_OnPlayerDisconnect (playerid=12, reason=1) at C:\Users\MaHdy\Desktop\HouseSystem.pwn:708 [21:38:27] [debug] #2 00007094 in public SSCANF_OnPlayerDisconnect (playerid=12, reason=1) at C:\Users\MaHdy\Desktop\SPA Orginal Build 2\pawno\include\streamer.inc:325 [21:38:27] [debug] #3 00000890 in public OnPlayerDisconnect (playerid=12, reason=1) at C:\Users\MaHdy\Desktop\SPA Orginal Build
Код:
public OnPlayerDisconnect(playerid, reason)
{
// Setup local variables
new HouseSlot;
// Loop through all Houses the player owns
for (HouseSlot = 0; HouseSlot < MAX_HOUSESPERPLAYER; HouseSlot++)
{
// Check if the player has a house in this houseslot
if (APlayerData[playerid][Houses][HouseSlot] != 0)
{
// Save the housefile
HouseFile_Save(APlayerData[playerid][Houses][HouseSlot]);
// Unload housecars if they were loaded when the owner logged in
if (LoadCarsDuringFSInit == false)
{
// Unload all vehicles assigned to this house
House_RemoveVehicles(APlayerData[playerid][Houses][HouseSlot]);
}
// Clear the HouseID stored in this houseslot
APlayerData[playerid][Houses][HouseSlot] = 0;
}
}
// Clear all data for this player
APlayerData[playerid][CurrentHouse] = 0;
APlayerData[playerid][DialogBuyVClass] = 0;
APlayerData[playerid][DialogGetCarHouseID] = 0;
return 1;
}
Код:
for (new CarSlot; CarSlot < AHouseData[HouseID][CarSlots]; CarSlot++)
{
// If a valid vehicle-id has been found
if (AHouseData[HouseID][VehicleIDs][CarSlot] != 0)
{
// Get the vehicle id
vid = AHouseData[HouseID][VehicleIDs][CarSlot];
format(LineForFile, 100, "[Vehicle]\r\n"); // Construct the line: "[Vehicle]"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "VehicleModel %i\r\n", AVehicleData[vid][Model]); // Construct the line: "VehicleModel <VehicleModel>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "VehiclePaintJob %i\r\n", AVehicleData[vid][PaintJob]); // Construct the line: "VehiclePaintJob <VehiclePaintJob>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "VehicleSpoiler %i\r\n", AVehicleData[vid][Components][0]); // Construct the line: "VehicleSpoiler <VehicleSpoiler>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "VehicleHood %i\r\n", AVehicleData[vid][Components][1]); // Construct the line: "VehicleHood <VehicleHood>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "VehicleRoof %i\r\n", AVehicleData[vid][Components][2]); // Construct the line: "VehicleRoof <VehicleRoof>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "VehicleSideSkirt %i\r\n", AVehicleData[vid][Components][3]); // Construct the line: "VehicleSideSkirt <VehicleSideSkirt>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "VehicleLamps %i\r\n", AVehicleData[vid][Components][4]); // Construct the line: "VehicleLamps <VehicleLamps>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "VehicleNitro %i\r\n", AVehicleData[vid][Components][5]); // Construct the line: "VehicleNitro <VehicleNitro>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "VehicleExhaust %i\r\n", AVehicleData[vid][Components][6]); // Construct the line: "VehicleSpoiler <VehicleSpoiler>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "VehicleWheels %i\r\n", AVehicleData[vid][Components][7]); // Construct the line: "VehicleWheels <VehicleWheels>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "VehicleStereo %i\r\n", AVehicleData[vid][Components][8]); // Construct the line: "VehicleStereo <VehicleStereo>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "VehicleHydraulics %i\r\n", AVehicleData[vid][Components][9]); // Construct the line: "VehicleHydraulics <VehicleHydraulics>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "VehicleFrontBumper %i\r\n", AVehicleData[vid][Components][10]); // Construct the line: "VehicleFrontBumper <VehicleFrontBumper>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "VehicleRearBumper %i\r\n", AVehicleData[vid][Components][11]); // Construct the line: "VehicleRearBumper <VehicleRearBumper>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "VehicleVentRight %i\r\n", AVehicleData[vid][Components][12]); // Construct the line: "VehicleVentRight <VehicleVentRight>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "VehicleVentLeft %i\r\n", AVehicleData[vid][Components][13]); // Construct the line: "VehicleVentLeft <VehicleVentLeft>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "Color1 %i\r\n", AVehicleData[vid][Color1]); // Construct the line: "Color1 <Color1>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "Color2 %i\r\n", AVehicleData[vid][Color2]); // Construct the line: "Color2 <Color2>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "VehicleX %f\r\n", AVehicleData[vid][SpawnX]); // Construct the line: "VehicleVentLeft <VehicleVentLeft>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "VehicleY %f\r\n", AVehicleData[vid][SpawnY]); // Construct the line: "VehicleVentLeft <VehicleVentLeft>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "VehicleZ %f\r\n", AVehicleData[vid][SpawnZ]); // Construct the line: "VehicleVentLeft <VehicleVentLeft>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "VehicleAngle %f\r\n", AVehicleData[vid][SpawnRot]); // Construct the line: "VehicleVentLeft <VehicleVentLeft>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "Fuel %i\r\n", INT_GetVehicleFuel(vid)); // Construct the line: "Fuel <Fuel>"
fwrite(HFile, LineForFile); // And save it to the file
format(LineForFile, 100, "[/Vehicle]\r\n"); // Construct the line: "[/Vehicle]"
fwrite(HFile, LineForFile); // And save it to the file
fwrite(HFile, "\r\n"); // Add an empty line, just for readability
}
}
fclose(HFile); // Close the file
return 1;
}
Код:
format(LineForFile, 100, "VehicleModel %i\r\n", AVehicleData[vid][Model]); // Construct the line: "VehicleModel <VehicleModel>"
