please server help
#1

Quote:

[12:02:06] [debug] Run time error 4: "Array index out of bounds"
[12:02:06] [debug] Accessing element at index 65535 past array upper bound 59
[12:02:06] [debug] AMX backtrace:
[12:02:06] [debug] #0 000541e8 in public OnPlayerTakeDamage (1, 65535, 1084122727, 53, 3) from lsti.amx

Quote:

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
//issuerid = ten co střlн
if(PlayerInDM[playerid] == 1 && PlayerBox[playerid] == 1) return 0;
if(GetPlayerVirtualWorld(issuerid) > 0 && GetPlayerVirtualWorld(playerid) > 0) return 0;
if(issuerid != INVALID_PLAYER_ID)
{
if(Hrac[Zamestnani][playerid] == POLDA)
{
if(PlayerPostrelen[playerid] == 0)
{
SetTimerEx("PovolPostreleni", 60000, 0, "i", issuerid);
PlayerPostrelen[playerid] = 1;
SetPlayerWantedLevelEx(issuerid, GetPlayerWantedLevel(issuerid) + 1);
SCM(issuerid,0x0000FFAA,"");
}
}
}

if(SeskokPlayer[playerid] == 1 || Sav[Novacek][playerid] == 0)
{
if(!IsPlayerInArea(playerid, AZ_FLOAT_X - AZ[Z_Radius], AZ_FLOAT_X + AZ[Z_Radius], AZ_FLOAT_Y - AZ[Z_Radius], AZ_FLOAT_Y + AZ[Z_Radius]))
{
new Float:hp, Float:Armour_GET;
//------------------------------
GetPlayerHealth(playerid, hp);
SetPlayerHealEx(playerid, hp);
//------------------------------
GetPlayerArmour(playerid,Armour_GET);
SetPlayerArmourEx(playerid,Armour_GET);
//------------------------------
}
}

if(AZ[Z_Stav] == 1 && AZ[Z_Zivot] == 1)
{
if(IsPlayerInArea(playerid, AZ_FLOAT_X - AZ[Z_Radius], AZ_FLOAT_X + AZ[Z_Radius], AZ_FLOAT_Y - AZ[Z_Radius], AZ_FLOAT_Y + AZ[Z_Radius]))
{
new Float:hp, Float:Armour_GET;
//------------------------------
GetPlayerHealth(playerid, hp);
SetPlayerHealEx(playerid, hp);
//------------------------------
GetPlayerArmour(playerid,Armour_GET);
SetPlayerArmourEx(playerid,Armour_GET);
//------------------------------
}
}

/*if(Sav[Novacek][issuerid] == 0)
{
GetPlayerMoney(issuerid, -10000);
SPIB(issuerid,"~r~Napadl jste novacka, bylo Vam odecteno -10,000$", ;
}*/

if(PlayerPostrelil[issuerid] == -1 && PlayerPostrelenEx[issuerid] == 0)
{
if(PlayerInDM[issuerid] == 0 && PlayerBox[issuerid] == 0)
{
PlayerPostrelil[issuerid] = playerid;
PlayerPostrelenEx[playerid] = 1;
}
}

if(Sav[Novacek][issuerid] == 0)
{
if(floatround(amount) > 5)
{
Sav[Novacek][issuerid] = 1;
SetPlayerColorEx(issuerid, 0xFFFFFFFF);
SCM(issuerid,0xFF0000AA,"");
CreateNovacek3D(issuerid);
}
}

return 1;
}

Please help
Reply
#2

The quote tag is for quotes, the code tag is for code. Simple logic, right? I'm 99.9% sure that it's caused by issuerid not being validated in all code paths, but I can't be bothered to look through unindented code.
Reply
#3

You check the issuerid is valid at the top in an if statment, but you don't do it for the rest.

You need to check that they're connected.

eg:

Код:
if(IsPlayerConnected(issuerid) && PlayerPostrelil[issuerid] == -1 && PlayerPostrelenEx[issuerid] == 0)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)