SA-MP Forums Archive
Run time error 4 [HELP REP+] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Run time error 4 [HELP REP+] (/showthread.php?tid=544460)



Re: Run time error 4 [HELP REP+] - Dziugsas - 02.11.2014

What do you do when this appears?It may be Max_players or somtething


Re: Run time error 4 [HELP REP+] - MasonSFW - 02.11.2014

When players death i will get that code


Re: Run time error 4 [HELP REP+] - Dziugsas - 02.11.2014

But it says onplayertakedamage.Please post it here.


Run time error 4 [HELP REP+] - MasonSFW - 02.11.2014

Код:
[08:35:11] [debug] Run time error 4: "Array index out of bounds"
[08:35:11] [debug]  Accessing element at index 65535 past array upper bound 499
[08:35:11] [debug] AMX backtrace:
[08:35:11] [debug] #0 000bc694 in public hl_OnPlayerTakeDamage (4, 65535, 1079194420, 54, 3) from TDM.amx
[08:35:11] [debug] #1 00022f34 in ?? (4, 65535, 1079194420, 54, 3) from TDM.amx
[08:35:11] [debug] #2 0001394c in public GPA_OnPlayerTakeDamage (4, 65535, 1079194420, 54, 3) from TDM.amx
[08:35:11] [debug] #3 native CallLocalFunction () from samp-server.exe
[08:35:11] [debug] #4 00003618 in public OnPlayerTakeDamage (4, 65535, 1079194420, 54, 3) from TDM.amx



Re: Run time error 4 [HELP REP+] - [HiC]TheKiller - 02.11.2014

You've probably got a variable that records damage. The chances are that you're doing something like this:

pawn Код:
new givendamage[MAX_PLAYERS];
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    givendamage[issuerid] = givendamage[issuerid]+amount;
    return 1;
}
This will simply not work. The reason being is that issuerid can be 65535 (Invalid player id) if the person gets fall or explosion damage. Take a look at the examples on https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage and note that they all check if issuerid is not INVALID_PLAYER_ID first.