
[19:10:06] [debug] Run time error 4: "Array index out of bounds" [19:10:06] [debug] Accessing element at negative index -399 [19:10:06] [debug] AMX backtrace: [19:10:06] [debug] #0 0026ecbc in public cmd_myvehicles (playerid=0, params[]=@0021506c "") at C:\Users\HP\Desktop\LV-MP\pawno\include\cnr/command.inc:678 [19:10:06] [debug] #1 native CallLocalFunction () from samp-server.exe [19:10:06] [debug] #2 0004c14c in public OnPlayerCommandText (playerid=0, cmdtext[]=@0021503c "/myvehicles") at C:\Users\HP\Desktop\LV-MP\pawno\include\required/zcmd.inc:102 [19:10:15] [pause] Veoper is now AFK.
COMMAND:myvehicles(playerid, params[])
{
new bool:found = false, msg[256];
for(new i = 0; i < MAX_VEH; i++)
{
if(!Vehicles[i][vehStatus]) continue;
if(Vehicles[i][vehOwner] == Player[playerid][pID])
{
found = true;
format(msg, sizeof(msg), "%s%s ID : "CHAT_YELLOW"%d"CHAT_WHITE"\n", msg, vehicleNames[Vehicles[i][vehModel] - 400], Vehicles[i][vehID]);
}
}
if(found)
{
if(Player[playerid][english])
ShowPlayerDialog(playerid, DIALOG_MYVEHICLES, DIALOG_STYLE_LIST, "My Vehicles", msg, "Choose", "Cancel");
else
ShowPlayerDialog(playerid, DIALOG_MYVEHICLES, DIALOG_STYLE_LIST, "Mobil Saya", msg, "Pilih", "Batal");
}
else
{
if(Player[playerid][english])
Server(playerid, "You didn't have any vehicles.");
else
Server(playerid, "Kamu tidak memiliki kendaraan.");
}
return 1;
}

[debug] Run time error 4: "Array index out of bounds" [debug] Accessing element at negative index -399 [debug] AMX backtrace: [debug] #0 001ebdec in public cmd_myvehicles (0, 2167060) from CCNR.amx [debug] #1 native CallLocalFunction () from samp-server.exe [debug] #2 0003f0cc in public OnPlayerCommandText (0, 2167012) from CCNR.amx
|
You haven't compiled with debug info (-d3 flag) correctly. Follow this step by step (https://github.com/Zeex/samp-plugin-...ith-debug-info) and try again.
About the problem now, you have posted the wrong code. The problem is in /myvehicles command. |

[19:10:06] [debug] Run time error 4: "Array index out of bounds" [19:10:06] [debug] Accessing element at negative index -399 [19:10:06] [debug] AMX backtrace: [19:10:06] [debug] #0 0026ecbc in public cmd_myvehicles (playerid=0, params[]=@0021506c "") at C:\Users\HP\Desktop\LV-MP\pawno\include\cnr/command.inc:678 [19:10:06] [debug] #1 native CallLocalFunction () from samp-server.exe [19:10:06] [debug] #2 0004c14c in public OnPlayerCommandText (playerid=0, cmdtext[]=@0021503c "/myvehicles") at C:\Users\HP\Desktop\LV-MP\pawno\include\required/zcmd.inc:102 [19:10:15] [pause] Veoper is now AFK.
COMMAND:myvehicles(playerid, params[])
{
new bool:found = false, msg[256];
for(new i = 0; i < MAX_VEH; i++)
{
if(!Vehicles[i][vehStatus]) continue;
if(Vehicles[i][vehOwner] == Player[playerid][pID])
{
found = true;
format(msg, sizeof(msg), "%s%s ID : "CHAT_YELLOW"%d"CHAT_WHITE"\n", msg, vehicleNames[Vehicles[i][vehModel] - 400], Vehicles[i][vehID]);
}
}
if(found)
{
if(Player[playerid][english])
ShowPlayerDialog(playerid, DIALOG_MYVEHICLES, DIALOG_STYLE_LIST, "My Vehicles", msg, "Choose", "Cancel");
else
ShowPlayerDialog(playerid, DIALOG_MYVEHICLES, DIALOG_STYLE_LIST, "Mobil Saya", msg, "Pilih", "Batal");
}
else
{
if(Player[playerid][english])
Server(playerid, "You didn't have any vehicles.");
else
Server(playerid, "Kamu tidak memiliki kendaraan.");
}
return 1;
}
vehicleNames[Vehicles[i][vehModel] - 400]
COMMAND:myvehicles(playerid, params[])
{
new bool:found = false, msg[256];
for(new i = 0; i < MAX_VEH; i++)
{
if(!Vehicles[i][vehStatus]) continue;
if(Vehicles[i][vehOwner] == Player[playerid][pID])
{
new vehicleid = Vehicles[i][vehID], modelid = GetVehicleModel(vehicleid);
found = true;
format(msg, sizeof(msg), "%s ID : "CHAT_YELLOW"%d"CHAT_WHITE"\n", vehicleNames[modelid - 400], vehicleid);
}
}
if(found)
{
if(Player[playerid][english])
ShowPlayerDialog(playerid, DIALOG_MYVEHICLES, DIALOG_STYLE_LIST, "My Vehicles", msg, "Choose", "Cancel");
else
ShowPlayerDialog(playerid, DIALOG_MYVEHICLES, DIALOG_STYLE_LIST, "Mobil Saya", msg, "Pilih", "Batal");
}
else
{
if(Player[playerid][english])
Server(playerid, "You didn't have any vehicles.");
else
Server(playerid, "Kamu tidak memiliki kendaraan.");
}
return 1;
}
|
Код:
COMMAND:myvehicles(playerid, params[])
{
new bool:found = false, msg[256];
for(new i = 0; i < MAX_VEH; i++)
{
if(!Vehicles[i][vehStatus]) continue;
if(Vehicles[i][vehOwner] == Player[playerid][pID])
{
new vehicleid = Vehicles[i][vehID], modelid = GetVehicleModel(vehicleid);
found = true;
format(msg, sizeof(msg), "%s ID : "CHAT_YELLOW"%d"CHAT_WHITE"\n", vehicleNames[modelid - 400], vehicleid);
}
}
if(found)
{
if(Player[playerid][english])
ShowPlayerDialog(playerid, DIALOG_MYVEHICLES, DIALOG_STYLE_LIST, "My Vehicles", msg, "Choose", "Cancel");
else
ShowPlayerDialog(playerid, DIALOG_MYVEHICLES, DIALOG_STYLE_LIST, "Mobil Saya", msg, "Pilih", "Batal");
}
else
{
if(Player[playerid][english])
Server(playerid, "You didn't have any vehicles.");
else
Server(playerid, "Kamu tidak memiliki kendaraan.");
}
return 1;
}
|