Errors in crashdetect "Array index out of bounds" -
tomasfernandez - 15.03.2017
[16:33:21] [debug] Run time error 4: "Array index out of bounds"
[16:33:21] [debug] Attempted to read/write array element at index 65535 in array of size 90
[16:33:21] [debug] AMX backtrace:
[16:33:21] [debug] #0 0002c3b0 in ?? (27, 65535, 1079194420, 54) from Mundito.amx
[16:33:21] [debug] #1 0000ff18 in public OnPlayerTakeDamage (27, 65535, 1079194420, 54, 3) from Mundito.amx
PHP код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
new Float:Vida;
GetPlayerHealth(playerid, Vida);
//==damage
#if defined SHOWN_ON_SCOREBOARD
totalDmg[issuerid] += amount;
SetPlayerScore(issuerid, floatround(totalDmg[issuerid]));
#endif
currentHpLoss[0][issuerid][playerid] += amount;
currentHpLoss[1][playerid][issuerid] += amount;
new
nick[MAX_PLAYER_NAME],
buffer[128];
GetPlayerName(playerid, nick, MAX_PLAYER_NAME);
format(buffer, 128, "~g~~h~~h~%s~n~~g~~h~~h~%i (%s)", nick, floatround(currentHpLoss[0][issuerid][playerid]), weaponName[weaponid]);
TextDrawSetString(txd[0][issuerid], buffer);
GetPlayerName(issuerid, nick, MAX_PLAYER_NAME);
format(buffer, 128, "~r~~h~%s~n~~r~~h~-%i (%s)", nick, floatround(currentHpLoss[1][playerid][issuerid]), weaponName[weaponid]);
TextDrawSetString(txd[1][playerid], buffer);
txdAlpha[0][issuerid] = 0xFF;
txdAlpha[1][playerid] = 0xFF;
return 1;
}
help me D:
Re: Errors in crashdetect "Array index out of bounds" -
Jefff - 15.03.2017
You need check issuerid is not INVALID_PLAYER_ID ( 65535 )
if(issuerid != INVALID_PLAYER_ID)
{
// code here
}
Respuesta: Errors in crashdetect "Array index out of bounds" -
tomasfernandez - 15.03.2017
PHP код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
new Float:Vida;
GetPlayerHealth(playerid, Vida);
//==damage
#if defined SHOWN_ON_SCOREBOARD
if(issuerid != INVALID_PLAYER_ID)
{
// code he
totalDmg[issuerid] += amount;
SetPlayerScore(issuerid, floatround(totalDmg[issuerid]));
#endif
currentHpLoss[0][issuerid][playerid] += amount;
currentHpLoss[1][playerid][issuerid] += amount;
new
nick[MAX_PLAYER_NAME],
buffer[128];
GetPlayerName(playerid, nick, MAX_PLAYER_NAME);
format(buffer, 128, "~g~~h~~h~%s~n~~g~~h~~h~%i (%s)", nick, floatround(currentHpLoss[0][issuerid][playerid]), weaponName[weaponid]);
TextDrawSetString(txd[0][issuerid], buffer);
GetPlayerName(issuerid, nick, MAX_PLAYER_NAME);
format(buffer, 128, "~r~~h~%s~n~~r~~h~-%i (%s)", nick, floatround(currentHpLoss[1][playerid][issuerid]), weaponName[weaponid]);
TextDrawSetString(txd[1][playerid], buffer);
txdAlpha[0][issuerid] = 0xFF;
txdAlpha[1][playerid] = 0xFF;
return 1;
}
Re: Errors in crashdetect "Array index out of bounds" -
Jefff - 15.03.2017
yees, add closing bracket } before return but PlayerSound should be too inside that if
Respuesta: Errors in crashdetect "Array index out of bounds" -
tomasfernandez - 15.03.2017
PHP код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
new Float:Vida;
GetPlayerHealth(playerid, Vida);
//==damage
#if defined SHOWN_ON_SCOREBOARD
if(issuerid != INVALID_PLAYER_ID)
{
}
// code he
totalDmg[issuerid] += amount;
SetPlayerScore(issuerid, floatround(totalDmg[issuerid]));
#endif
currentHpLoss[0][issuerid][playerid] += amount;
currentHpLoss[1][playerid][issuerid] += amount;
new
nick[MAX_PLAYER_NAME],
buffer[128];
GetPlayerName(playerid, nick, MAX_PLAYER_NAME);
format(buffer, 128, "~g~~h~~h~%s~n~~g~~h~~h~%i (%s)", nick, floatround(currentHpLoss[0][issuerid][playerid]), weaponName[weaponid]);
TextDrawSetString(txd[0][issuerid], buffer);
GetPlayerName(issuerid, nick, MAX_PLAYER_NAME);
format(buffer, 128, "~r~~h~%s~n~~r~~h~-%i (%s)", nick, floatround(currentHpLoss[1][playerid][issuerid]), weaponName[weaponid]);
TextDrawSetString(txd[1][playerid], buffer);
txdAlpha[0][issuerid] = 0xFF;
txdAlpha[1][playerid] = 0xFF;
return 1;
}
It's okay like this?? :/
Re: Errors in crashdetect "Array index out of bounds" -
Jefff - 15.03.2017
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID)
{
PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
new Float:Vida;
GetPlayerHealth(playerid, Vida);
//==damage
#if defined SHOWN_ON_SCOREBOARD
totalDmg[issuerid] += amount;
SetPlayerScore(issuerid, floatround(totalDmg[issuerid]));
#endif
currentHpLoss[0][issuerid][playerid] += amount;
currentHpLoss[1][playerid][issuerid] += amount;
new
nick[MAX_PLAYER_NAME],
buffer[128]
;
GetPlayerName(playerid, nick, MAX_PLAYER_NAME);
format(buffer, 128, "~g~~h~~h~%s~n~~g~~h~~h~%i (%s)", nick, floatround(currentHpLoss[0][issuerid][playerid]), weaponName[weaponid]);
TextDrawSetString(txd[0][issuerid], buffer);
GetPlayerName(issuerid, nick, MAX_PLAYER_NAME);
format(buffer, 128, "~r~~h~%s~n~~r~~h~-%i (%s)", nick, floatround(currentHpLoss[1][playerid][issuerid]), weaponName[weaponid]);
TextDrawSetString(txd[1][playerid], buffer);
txdAlpha[0][issuerid] = 0xFF;
txdAlpha[1][playerid] = 0xFF;
}
return 1;
}
Respuesta: Errors in crashdetect "Array index out of bounds" -
tomasfernandez - 15.03.2017
tranks
DDD !!!!