27.03.2016, 08:50
pawn Код:
C:\CR-RPv1.0.pwn(1440) : error 032: array index out of bounds (variable "APlayerData")
C:\CR-RPv1.0.pwn(1441) : error 032: array index out of bounds (variable "APlayerData")
C:\CR-RPv1.0.pwn(4615) : error 032: array index out of bounds (variable "APlayerData")
C:\CR-RPv1.0.pwn(4621) : error 032: array index out of bounds (variable "APlayerData")
C:\CR-RPv1.0.pwn(4638) : error 032: array index out of bounds (variable "APlayerData")
C:\CR-RPv1.0.pwn(4679) : error 032: array index out of bounds (variable "APlayerData")
C:\CR-RPv1.0.pwn(4854) : error 032: array index out of bounds (variable "APlayerData")
C:\CR-RPv1.0.pwn(4898) : error 032: array index out of bounds (variable "APlayerData")
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
TextDrawDestroy(SpeedoText[playerid]);
// 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;
// Setup local variables
new BusSlot;
// Loop through all businesses the player owns
for (BusSlot = 0; BusSlot < MAX_BUSINESSPERPLAYER; BusSlot++)
{
// Check if the player has a business in this busslot
if (APlayerData[playerid][Business][BusSlot] != 0)
{
// Save the Busfile
BusinessFile_Save(APlayerData[playerid][Business][BusSlot]);
// Clear the BusID stored in this busslot
APlayerData[playerid][Business][BusSlot] = 0;
}
}
}
}
// Clear all data for this player
APlayerData[playerid][CurrentBusiness] = 0;
APlayerData[playerid][CurrentHouse] = 0;
APlayerData[playerid][DialogBuyVClass] = 0;
APlayerData[playerid][DialogGetCarHouseID] = 0;
return 1;
}
pawn Код:
Dialog_BuyCarClass(playerid, response, listitem)
{
// Just close the dialog if the player clicked "Cancel"
if(!response) return 1;
// Setup local variables
new CarList[1000], DialogTitle[128];
// Set the player's chosen vehicle-class based on the listitem he chose (add 1 as the vehicleclass starts at 1)
APlayerData[playerid][DialogBuyVClass] = listitem + 1;
// Add all vehicles of the same class to the list
for (new i; i < sizeof(ABuyableVehicles); i++)
{
// Check if the vehicle in the list has the same class as requested
if (ABuyableVehicles[i][VehicleClass] == APlayerData[playerid][DialogBuyVClass])
{
// Add the carname to the list and it's price
format(CarList, 1000, "%s%s%s ($%i)", CarList, "\n", ABuyableVehicles[i][CarName], ABuyableVehicles[i][Price]); // Add the name of the next car to the list on the next line
}
}
// Check if the list is empty
if (strlen(CarList) == 0)
{
// Send the player a message that all vehicles have been disabled of the chosen class (no vehicles in the array of this class)
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}This is an empty list, the administrator may have disabled all vehicles of this class");
// Exit the function (don't ask to choose a vehicle)
return 1;
}
// Set a title for the dialog based on the requested vehicleclass
switch (APlayerData[playerid][DialogBuyVClass])
{
case VClassBike: format(DialogTitle, 128, "Buy a bike:");
case VClassBoat: format(DialogTitle, 128, "Buy a boat:");
case VClassConvertible: format(DialogTitle, 128, "Buy a convertible:");
case VClassHelicopter: format(DialogTitle, 128, "Buy a helicopter:");
case VClassIndustrial: format(DialogTitle, 128, "Buy a industrial vehicle:");
case VClassLowRider: format(DialogTitle, 128, "Buy a low-rider:");
case VClassOffRoad: format(DialogTitle, 128, "Buy an off-road vehicle:");
case VClassPlane: format(DialogTitle, 128, "Buy a plane:");
case VClassPublic: format(DialogTitle, 128, "Buy a public service vehicle:");
case VClassRCVehicle: format(DialogTitle, 128, "Buy a RC vehicle:");
case VClassSaloons: format(DialogTitle, 128, "Buy a saloon vehicle:");
case VClassSportCar: format(DialogTitle, 128, "Buy a sport vehicle:");
case VClassStationCar: format(DialogTitle, 128, "Buy a stationwagon:");
case VClassTrailer: format(DialogTitle, 128, "Buy a trailer:");
case VClassUnique: format(DialogTitle, 128, "Buy a unique vehicle:");
}
// Ask which car the player wants to have by showing the dialog
ShowPlayerDialog(playerid, DialogBuyCar, DIALOG_STYLE_LIST, DialogTitle, CarList, "Select", "Cancel");
return 1;
}
Dialog_GetCarSelectCar(playerid, response, listitem)
{
// Just close the dialog if the player clicked "Cancel"
if(!response) return 1;
// Get the HouseID from which to get the car
new HouseID = APlayerData[playerid][DialogGetCarHouseID];
// Get the vehicleid from the chosen listitem
new vid = AHouseData[HouseID][VehicleIDs][listitem];
// Check if it was a valid vehicleid
if (vid != 0)
{
// Setup local variables
new Float:x, Float:y, Float:z, Float:Angle;
// Get the player's position
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, Angle);
// Port the vehicle to the player
SetVehiclePos(vid, x, y, z);
// Put the player inside the vehicle and rotate the vehicle to face where the player was facing
PutPlayerInVehicle(playerid, vid, 0);
SetVehicleZAngle(vid, Angle);
// Turn on the engine and lights
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vid, 1, 1, alarm, doors, bonnet, boot, objective);
// Let the player know he should park the vehicle
SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}You've spawned your vehicle, now use \"{FFFF00}/park{00FF00}\" to park it near your house");
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}No vehicle exists in this vehicle-slot");
return 1;
}
Please Help