[04:05:52] [debug] Run time error 4: "Array index out of bounds"
[04:05:52] [debug] Accessing element at index 65535 past array upper bound 1999
[04:05:52] [debug] AMX backtrace:
[04:05:52] [debug] #0 00113700 in LoadVehicles (storeid=9) at C:\Users\-\Desktop\voor reboot\unnamed roleplay\gamemodes\DL-RP.pwn:21373
[04:05:52] [debug] #1 001fc2bc in InitVehicles () at C:\Users\-\Desktop\voor reboot\unnamed roleplay\gamemodes\DL-RP.pwn:28401
[04:05:52] [debug] #2 000174b4 in public S@@_OnGameModeInit () at C:\Users\-\Desktop\voor reboot\unnamed roleplay\gamemodes\DL-RP.pwn:1774
[04:05:52] [debug] #3 00006dc8 in public Itter_OnGameModeInit () at C:\Users\-\Desktop\voor reboot\unnamed roleplay\pawno\include\YSI\y_hooks/impl.inc:484
[04:05:52] [debug] #4 native CallLocalFunction () [004743b0] from samp-server.exe
[04:05:52] [debug] #5 00001dc4 in public ScriptInit_OnGameModeInit () at C:\Users\-\Desktop\voor reboot\unnamed roleplay\pawno\include\YSI\y_iterate.inc:791
[04:05:52] [debug] #6 000009e4 in Debug_Print0 () at C:\Users\-\Desktop\voor reboot\unnamed roleplay\pawno\include\YSI\internal\..\y_scriptinit.inc:171
[04:05:52] [debug] #7 native CallLocalFunction () [004743b0] from samp-server.exe
[04:05:52] [debug] #8 000003b8 in Debug_Print0 () at C:\Users\-\Desktop\voor reboot\unnamed roleplay\pawno\include\zcmd.inc:68
[04:05:52]
[04:05:52]
[04:05:52] -----------------------GAMEMODE LOADING-----------------------
[04:05:52] -----------------------Script has been loaded --------------------
[04:05:52] -----------------------GAMEMODE LOADED------------------------
[04:05:52]
[04:05:52]
[04:05:52] Number of vehicle models: 2
[04:06:11] [connection] 192.168.178.20:58943 requests connection cookie.
[04:06:12] [connection] incoming connection: 192.168.178.20:58943 id: 0
[04:06:12] [debug] Run time error 20: "Invalid index parameter (bad entry point)"
VehicleBattery[Vehicles[storeid][DLID]] = 100;
stock InitVehicles()
{
for(new id; id < MAX_SERVERVEHICLES; id++) // Goes through all the slots, looking for the data
{
LoadVehicles(id);
} <<<< 28401
return 1;
}
InitBusinesses();
VehicleBattery[Vehicles[storeid][DLID]] = 100;
VehicleBattery[Vehicles[storeid]][DLID] = 100;
shoudn't this be:
pawn Код:
pawn Код:
|
LoadVehicles(storeid)
{
new Data[150],Field[258],idx;
mysql_queryS("SELECT * FROM `Vehicles` WHERE `VehicleID` = %d",storeid);
mysql_store_result();
if(mysql_num_rows() == 1){
mysql_fetch_rowEx(Data);
Field = strtuk( Data, idx, '|' );
for(new s = 0; s < 20; s++)
{
switch(s)
{
case 0: Vehicles[storeid][VehicleID] = strval(Field);
case 1: Vehicles[storeid][ModelID] = strval(Field);
case 2: Vehicles[storeid][Color1] = strval(Field);
case 3: Vehicles[storeid][Color2] = strval(Field);
case 4: Vehicles[storeid][VPosX] = floatstr(Field);
case 5: Vehicles[storeid][VPosY] = floatstr(Field);
case 6: Vehicles[storeid][VPosZ] = floatstr(Field);
case 7: Vehicles[storeid][VPosAngle] = floatstr(Field);
case 8: Vehicles[storeid][LockStatus] = strval(Field);
case 9: Vehicles[storeid][FactionCar] = strval(Field);
case 10: strmid(Vehicles[storeid][VOwner],Field,0,strlen(Field),255);
case 11: strmid(Vehicles[storeid][VPlate],Field,0,strlen(Field),255);
case 12: Vehicles[storeid][SpeedoColor] = strval(Field);
case 13: Vehicles[storeid][FlashAble] = strval(Field);
case 14: Vehicles[storeid][RDuty] = strval(Field);
case 15: Vehicles[storeid][VehicleWorld] = strval(Field);
case 16: Vehicles[storeid][VehicleInteriorID] = strval(Field);
case 17: Vehicles[storeid][Impounded] = strval(Field);
case 18: Vehicles[storeid][SavedVehicle] = strval(Field);
}
Field = strtuk( Data, idx, '|' );
}
if(Vehicles[storeid][JustChangedColor] == 1)
{
Vehicles[storeid][DLID] = CreateVehicle(Vehicles[storeid][ModelID], Vehicles[storeid][VPosX], Vehicles[storeid][VPosY], Vehicles[storeid][VPosZ], Vehicles[storeid][VPosAngle], Vehicles[storeid][Color1], Vehicles[storeid][Color2], -1);
SetVehicleVirtualWorld(Vehicles[storeid][DLID], 0);
LinkVehicleToInterior(Vehicles[storeid][DLID], 0);
Vehicles[storeid][JustChangedColor] = 0;
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(Vehicles[storeid][DLID],engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(Vehicles[storeid][DLID],VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
}
else
{
Vehicles[storeid][DLID] = CreateVehicle(Vehicles[storeid][ModelID], Vehicles[storeid][VPosX], Vehicles[storeid][VPosY], Vehicles[storeid][VPosZ], Vehicles[storeid][VPosAngle], Vehicles[storeid][Color1], Vehicles[storeid][Color2], -1);
SetVehicleVirtualWorld(Vehicles[storeid][DLID], Vehicles[storeid][VehicleWorld]);
LinkVehicleToInterior(Vehicles[storeid][DLID], Vehicles[storeid][VehicleInteriorID]);
VehicleFuel[Vehicles[storeid][DLID]] = 100;
VehicleBattery[Vehicles[storeid][DLID]] = 100;
}
SetVehicleNumberPlate(Vehicles[storeid][DLID], Vehicles[storeid][VPlate]);
Vehicles[Vehicles[storeid][DLID]][SavedVehicle] = 1;
if(Vehicles[storeid][JustChanged] == 1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(Player[i][JustChangedCar] == Vehicles[storeid][DLID])
{
PutPlayerInVehicle(i, Vehicles[storeid][DLID], 0);
Vehicles[storeid][JustChanged] = 0;
Player[i][JustChangedCar] = -1;
}
}
}
printf("[System] Vehicle Slot: %d, Vehicle /dl: %d, has been successfully spawned!", storeid, Vehicles[storeid][DLID]);
ServerVehicle[Vehicles[storeid][DLID]] = 1;
SpawnedVehicles++;
mysql_free_result();
}
}
LoadOwnedVehicle(storeid, playerid)
{
new Data[150],Field[258],idx;
mysql_queryS("SELECT * FROM `OwnedVehicles` WHERE `vStoreID` = %d",storeid);
mysql_store_result();
if(mysql_num_rows() == 1){
mysql_fetch_rowEx(Data);
Field = strtuk( Data, idx, '|' );
for(new s = 0; s < 20; s++)
{
switch(s)
{
case 0: OwnedVehicles[storeid][vStoreID] = strval(Field);
case 1: OwnedVehicles[storeid][vModelID] = strval(Field);
case 2: OwnedVehicles[storeid][vColor1] = strval(Field);
case 3: OwnedVehicles[storeid][vColor2] = strval(Field);
case 4: OwnedVehicles[storeid][vPositionX] = floatstr(Field);
case 5: OwnedVehicles[storeid][vPositionY] = floatstr(Field);
case 6: OwnedVehicles[storeid][vPositionZ] = floatstr(Field);
case 7: OwnedVehicles[storeid][vPositionAngle] = floatstr(Field);
case 8: OwnedVehicles[storeid][vLockStatus] = strval(Field);
case 9: strmid(OwnedVehicles[storeid][VehicleOwner],Field,0,strlen(Field),255);
case 10: strmid(OwnedVehicles[storeid][VehiclePlate],Field,0,strlen(Field),255);
case 11: OwnedVehicles[storeid][vSpeedoColor] = strval(Field);
case 12: OwnedVehicles[storeid][vWorld] = strval(Field);
case 13: OwnedVehicles[storeid][vInteriorID] = strval(Field);
case 14: OwnedVehicles[storeid][vImpounded] = strval(Field);
case 15: OwnedVehicles[storeid][vSavedVehicle] = strval(Field);
case 16: OwnedVehicles[storeid][vFuel] = strval(Field);
case 17: OwnedVehicles[storeid][vBattery] = strval(Field);
}
Field = strtuk( Data, idx, '|' );
}
if(OwnedVehicles[storeid][vJustChangedColor] == 1)
{
OwnedVehicles[storeid][vDLID] = CreateVehicle(OwnedVehicles[storeid][vModelID], OwnedVehicles[storeid][vPositionX], OwnedVehicles[storeid][vPositionY], OwnedVehicles[storeid][vPositionZ], OwnedVehicles[storeid][vPositionAngle], OwnedVehicles[storeid][vColor1], OwnedVehicles[storeid][vColor2], -1);
SetVehicleVirtualWorld(OwnedVehicles[storeid][vDLID], 0);
LinkVehicleToInterior(OwnedVehicles[storeid][vDLID], 0);
OwnedVehicles[storeid][vJustChangedColor] = 0;
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(OwnedVehicles[storeid][vDLID],engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(OwnedVehicles[storeid][vDLID],VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
}
else
{
if(OwnedVehicles[storeid][vImpounded] == 1)
{
ImpoundCount++;
if(ImpoundCount >= 48)
{
new rand = random(sizeof(RandomImpoundSpawn));
OwnedVehicles[storeid][vDLID] = CreateVehicle(OwnedVehicles[storeid][vModelID], RandomImpoundSpawn[rand][0], RandomImpoundSpawn[rand][1], RandomImpoundSpawn[rand][2], RandomImpoundSpawn[rand][3], OwnedVehicles[storeid][vColor1], OwnedVehicles[storeid][vColor2], -1);
SetVehicleVirtualWorld(OwnedVehicles[storeid][vDLID], OwnedVehicles[storeid][vDLID]);//set vw
VehicleFuel[OwnedVehicles[storeid][vDLID]] = OwnedVehicles[storeid][vFuel];
VehicleBattery[OwnedVehicles[storeid][vDLID]] = OwnedVehicles[storeid][vBattery];
}else{
OwnedVehicles[storeid][vDLID] = CreateVehicle(OwnedVehicles[storeid][vModelID], RandomImpoundSpawn[ImpoundCount][0], RandomImpoundSpawn[ImpoundCount][1], RandomImpoundSpawn[ImpoundCount][2], RandomImpoundSpawn[ImpoundCount][3], OwnedVehicles[storeid][vColor1], OwnedVehicles[storeid][vColor2], -1);
SetVehicleVirtualWorld(OwnedVehicles[storeid][vDLID], 0);
LinkVehicleToInterior(OwnedVehicles[storeid][vDLID], 0);
VehicleFuel[OwnedVehicles[storeid][vDLID]] = OwnedVehicles[storeid][vFuel];
VehicleBattery[OwnedVehicles[storeid][vDLID]] = OwnedVehicles[storeid][vBattery];
VehicleJustImpounded[OwnedVehicles[storeid][vDLID]] = 0;
}
}
else
{
OwnedVehicles[storeid][vDLID] = CreateVehicle(OwnedVehicles[storeid][vModelID], OwnedVehicles[storeid][vPositionX], OwnedVehicles[storeid][vPositionY], OwnedVehicles[storeid][vPositionZ], OwnedVehicles[storeid][vPositionAngle], OwnedVehicles[storeid][vColor1], OwnedVehicles[storeid][vColor2], -1);
SetVehicleVirtualWorld(OwnedVehicles[storeid][vDLID], OwnedVehicles[storeid][vWorld]);//set vw
LinkVehicleToInterior(OwnedVehicles[storeid][vDLID], OwnedVehicles[storeid][vInteriorID]);//set int
VehicleFuel[OwnedVehicles[storeid][vDLID]] = OwnedVehicles[storeid][vFuel];
VehicleBattery[OwnedVehicles[storeid][vDLID]]= OwnedVehicles[storeid][vBattery];
}
}
SetVehicleNumberPlate(OwnedVehicles[storeid][vDLID], OwnedVehicles[storeid][VehiclePlate]);
OwnedVehicles[storeid][vSavedVehicle] = 1;
OwnedVehicles[storeid][vSpawned] = 1;
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(OwnedVehicles[storeid][vDLID],engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(OwnedVehicles[storeid][vDLID],engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective);
if(OwnedVehicles[storeid][vJustChanged] == 1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(Player[i][JustChangedCar] == OwnedVehicles[storeid][vDLID])
{
PutPlayerInVehicle(i, OwnedVehicles[storeid][vDLID], 0);
OwnedVehicles[storeid][vJustChanged] = 0;
Player[i][JustChangedCar] = -1;
}
}
}
if(playerid != -1)
{
fSendClientMessage(playerid, GRAYLOGIN, "> Your Vehicle: %s with Plate: %s, has been spawned!", GetVehicleName(OwnedVehicles[storeid][vModelID]), OwnedVehicles[storeid][VehiclePlate]);
fSendClientMessage(playerid, GRAYLOGIN, "> It is located in %s!",GetVehicleZone(OwnedVehicles[storeid][vDLID]));
Player[playerid][SpawnedPersonalCar] = OwnedVehicles[storeid][vDLID];
//SetPlayerCheckpoint(playerid, OwnedVehicles[storeid][vPositionX], OwnedVehicles[storeid][vPositionY], OwnedVehicles[storeid][vPositionZ], 5.0);
//Player[playerid][Checkpoint] = 1;
}
ServerVehicle[OwnedVehicles[storeid][vDLID]] = 0;
SpawnedVehicles++;
mysql_free_result();
}
}
AssignOwnedVehicles(playerid)
{
new Data[1000],Field[258],idx;
new MyCarStoreID;
mysql_queryM("SELECT `vStoreID` FROM `OwnedVehicles` WHERE `VehicleOwner` = '%s' LIMIT 10",GetName(playerid));
mysql_store_result();
if(mysql_num_rows() >= 0){
for(new i=0; i < mysql_num_rows(); i++){
mysql_fetch_rowEx(Data);
idx = 0;
Field = strtuk( Data, idx, '|' );
for(new s = 0; s < 4; s++)
{
switch(s)
{
case 0: MyCarStoreID = strval(Field);
}
Field = strtuk( Data, idx, '|' );
}
if(PlayerVehicleSlot[playerid][i] == -1){PlayerVehicleSlot[playerid][i] = MyCarStoreID;}
}
}
return 1;
}
ServerVehicle[Vehicles[storeid]][DLID] = 1;
okay just change
[pawn] ServerVehicle[Vehicles[storeid][DLID]] = 1; [/pwn] to pawn Код:
|
C:\Users\-\Desktop\voor reboot\unnamed roleplay\gamemodes\DL-RP.pwn(21392) : error 033: array must be indexed (variable "Vehicles")
C:\Users\-\Desktop\voor reboot\unnamed roleplay\gamemodes\DL-RP.pwn(21392) : error 029: invalid expression, assumed zero
C:\Users\-\Desktop\voor reboot\unnamed roleplay\gamemodes\DL-RP.pwn(21392) : warning 215: expression has no effect
C:\Users\-\Desktop\voor reboot\unnamed roleplay\gamemodes\DL-RP.pwn(21392) : error 001: expected token: ";", but found "]"
C:\Users\-\Desktop\voor reboot\unnamed roleplay\gamemodes\DL-RP.pwn(21392) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
public BatteryUpdate()
{
new engine,lights,alarm,doors,bonnet,boot,objective;
for(new i=0;i<MAX_SERVERVEHICLES;i++)
{
GetVehicleParamsEx(i,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine == 1)
{
if(VehicleBattery[i] != 100)
{
VehicleBattery[i] += 1;
}
}
else if(engine == 0 && lights == 1)
{
if(VehicleBattery[i] >= 5)
{
VehicleBattery[i] -= 1;
}
else
{
SetVehicleParamsEx(i,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
}
}
}
}
new VehicleFuel[MAX_VEHICLES];
new VehicleBattery[MAX_VEHICLES]; new ServerVehicle[MAX_VEHICLES] = 0; PHP код:
|
MAX_SERVERVEHICLES
MAX_VEHICLES
Why are you looping through
Код:
MAX_SERVERVEHICLES Код:
MAX_VEHICLES |