[20:54:20] [debug] Run time error 4: "Array index out of bounds"
[20:54:20] [debug] Accessing element at negative index -1
[20:54:20] [debug] AMX backtrace:
[20:54:20] [debug] #0 000781c0 in public OnPlayerEnterDynamicCP (3, 5) from PerfectDM.amx
if(checkpointid == Player[playerid][MissionBankTimerAndCP])
{
if(Player[playerid][PlayerBankRob] > 0)
{
DestroyDynamicCP(Player[playerid][MissionBankTimerAndCP]);
DestroyDynamic3DTextLabel(Player[playerid][MissionBank3DText]);
TogglePlayerDynamicCP(playerid, Server[MissionBankCP], 1);
UpdateBank(playerid, Player[playerid][PlayerBankRob]);
Message(-1, Red, "[Bank] >> "white"!הצליח לשדוד את הבנק \"%s\" השחקן", GetName(Player[playerid][MissionBankTargetID]), GetName(playerid));
Message(-1, Red, "[Bank] >> "green"$%s "white":סכום השוד", GetNum(Player[playerid][PlayerBankRob]));
GivePlayerMoney(playerid, -Player[playerid][PlayerBankRob]);
return Player[playerid][PlayerBankRob] = 0, 1;
}
return 1;
}
...
MissionBankTimerAndCP,
PlayerBankRob,
Text3D:MissionBank3DText,
MissionBankTargetID,
...
Compile with -d3: https://github.com/Zeex/samp-plugin-...ith-debug-info
In case you don't have the latest version of crashdetect plugin, it's recommended to update it and try to reproduce the crash. After that, you'll get more information to the logs such as the line. |
[22:05:06] [debug] Run time error 4: "Array index out of bounds"
[22:05:06] [debug] Accessing element at negative index -1
[22:05:06] [debug] AMX backtrace:
[22:05:06] [debug] #0 00078588 in public OnPlayerEnterDynamicCP (3, 5) from PerfectDM.amx
I've been using your code, the failure seems to be in the "Message" Function
what's the code of it? |
stock Message(playerid, color, const message[], va_args<>)
{
if(playerid == -1 || playerid == INVALID_PLAYER_ID)
{
#pragma unused playerid
return SendClientMessageToAll(color, va_return(message, va_start<3>));
}
else return SendClientMessage(playerid, color, va_return(message, va_start<3>));
}
Did it show more information at the compiler output? And if so, did you run the new file (the .amx one) you got after compiling? If done the above and it still does not show the line, then you'll have to do it with the old way. print messages before and after a certain line and see what's the last part was executed.
|
[19:27:48] Error
[19:27:48] Error
[19:27:48] Error
[19:27:48] Error
[19:27:48] Error
[19:27:48] [debug] Run time error 4: "Array index out of bounds"
[19:27:48] [debug] Accessing element at negative index -1
[19:27:48] [debug] AMX backtrace:
[19:27:48] [debug] #0 00078318 in public OnPlayerEnterDynamicCP (3, 5) from PerfectDM.amx
if(checkpointid == Player[playerid][MissionBankTimerAndCP])
{
if(Player[playerid][PlayerBankRob] > 0)
{
DestroyDynamicCP(Player[playerid][MissionBankTimerAndCP]);
print("OPEDCP: Destroyed CP");
DestroyDynamic3DTextLabel(Player[playerid][MissionBank3DText]);
print("OPEDCP: Destroyed 3D Label");
TogglePlayerDynamicCP(playerid, Server[MissionBankCP], 1);
print("OPEDCP: Toggled CP");
UpdateBank(playerid, Player[playerid][PlayerBankRob]);
print("OPEDCP: Updated Bank");
Message(-1, Red, "[Bank] >> "white"!הצליח לשדוד את הבנק \"%s\" השחקן", GetName(Player[playerid][MissionBankTargetID]), GetName(playerid));
print("OPEDCP: Message Sent (1)");
Message(-1, Red, "[Bank] >> "green"$%s "white":סכום השוד", GetNum(Player[playerid][PlayerBankRob]));
print("OPEDCP: Message Sent (2)");
GivePlayerMoney(playerid, -Player[playerid][PlayerBankRob]);
print("OPEDCP: Gave Money");
Player[playerid][PlayerBankRob] = 0;
print("OPEDCP: Reset Variable");
}
}