Run time error 4: "Array index out of bounds"
#1

I get this errors in the console:
Код:
[debug] Run time error 4: "Array index out of bounds"
[15:01:35] [debug]  Accessing element at index 11 past array upper bound 9
[15:01:35] [debug] AMX backtrace:
[15:01:35] [debug] #0 00010aa4 in public OnPlayerSpawn (0x00000000) from LuxAdmin.amx
OnPlayerSpawn
Код:
public OnPlayerSpawn(playerid)
{
	printf("|- %s(%d) Spawned -|", PlayerName2(playerid), playerid);
	//--------------------------------------------------------------------------
	// Player Frozen (Prevent scape)
	//--------------------------------------------------------------------------
	AccInfo[playerid][Spawned] = 1;
	//--------------------------------------------------------------------------
	if(AccInfo[playerid][Frozen] == 1)
	{
		TogglePlayerControllable(playerid,false);
		return SendClientMessage(playerid,red,"|- You can't escape your punishment. You Are Still Frozen -|");
	}
	//--------------------------------------------------------------------------
	// Player Jail (Prevent scape)
	//--------------------------------------------------------------------------
	if(AccInfo[playerid][Jailed] == 1)
	{
	    AccInfo[playerid][God] = 1;
		ResetPlayerWeapons(playerid);
	    SetTimerEx("JailPlayer", 3000, false, "i", playerid);
		return SendClientMessage(playerid,red,"|- You can't escape your punishment. You Are Still In Jail -|");
	}
	//--------------------------------------------------------------------------
	//Player Clan Weapons  Anulat
	//--------------------------------------------------------------------------
	if(IsPlayerAnyClanMember(playerid))
  	{
		SetPlayerColor(playerid, ClanColors[GetClanColor(GetPlayerClan(playerid))]);
		GivePlayerWeapon(playerid, GetClanWeapon1(GetPlayerClan(playerid)), 1000000);
		GivePlayerWeapon(playerid, GetClanWeapon2(GetPlayerClan(playerid)), 1000000);
		GivePlayerWeapon(playerid, GetClanWeapon3(GetPlayerClan(playerid)), 1000000);
		GivePlayerWeapon(playerid, GetClanWeapon4(GetPlayerClan(playerid)), 1000000);
		GivePlayerWeapon(playerid, GetClanWeapon5(GetPlayerClan(playerid)), 1000000);
		GivePlayerWeapon(playerid, GetClanWeapon6(GetPlayerClan(playerid)), 1000000);
  	}
  	//--------------------------------------------------------------------------
    //Server Spawn's
    //--------------------------------------------------------------------------
    new RandomPSpawn = random(7);
    switch(RandomPSpawn)
    {
		case 0: SetPlayerPos(playerid, 404.8082,2448.4775,16.1368);			//AA
	    case 1: SetPlayerPos(playerid, 1857.1230,-2281.7593,17.0903);		//LSAir
	    case 2: SetPlayerPos(playerid, -1374.3136,-257.4903,19.3436);		//SFAir
	    case 3: SetPlayerPos(playerid, 1590.6398,1448.2764,14.3303);		//LVAir
	    case 4: SetPlayerPos(playerid, -2335.8875,-1626.1935,483.3552);		//Chilliad
	    case 5: SetPlayerPos(playerid, -527.418701,2023.649047,48.490310);	//Stunt Dam
	    case 6: SetPlayerPos(playerid, -2633.8022,1359.0215,6.6751); 		//SFStunt
	}

	//--------------------------------------------------------------------------
	//Setting Player Skin
	//--------------------------------------------------------------------------
	if(AccInfo[playerid][Level] > 0 || AccInfo[playerid][pVip] > 0)
	{
	    if(AccInfo[playerid][USkin] == 1)
	    {
	        SetPlayerSkin(playerid, AccInfo[playerid][FSkin]);
	    }
	}
 	//--------------------------------------------------------------------------
 	//Holds System
 	//--------------------------------------------------------------------------
 	if(AccInfo[playerid][WMode] == 0)
 	{
		if(AccInfo[playerid][UHolds] == 1)
		{
			for(new i; i < 10; i++)
			{
				RemovePlayerAttachedObject(playerid,i);
			}
		    LoadPlayerHolds(playerid);
		}
		else
		{
			for(new i; i < 10; i++)
			{
				RemovePlayerAttachedObject(playerid,i);
			}
		}
	}
	else if(AccInfo[playerid][WMode] == 1)
	{
		SetPlayerWeather(playerid, 40);
	    SetPlayerTime(playerid, 0, 0);
		//----------------------------------------------------------------------
		for(new i; i < 10; i++)
		{
			RemovePlayerAttachedObject(playerid, i);
		}
		//----------------------------------------------------------------------
 		SetPlayerAttachedObject(playerid, 0, 19065, 2, 0.121128, 0.023578, 0.001139, 222.540847, 90.773872, 211.130859, 1.098305, 1.122310, 1.106640 ); // SantaHat
 		SetPlayerAttachedObject(playerid, 1, 18864, 2); // Snow
		//----------------------------------------------------------------------
	}
	return 1;
}
And this:
Код:
[debug] Run time error 4: "Array index out of bounds"
[15:05:58] [debug]  Accessing element at index 996 past array upper bound 995
[15:05:58] [debug] AMX backtrace:
[15:05:58] [debug] #0 0000c5cc in public OnFilterScriptExit () from LuxAdmin.amx
OnFilterScriptExit
Код:
public OnFilterScriptExit()
{
	//--------------------------------------------------------------------------
    BUD::Exit(); KillTimer(PingTimer); KillTimer(GodTimer);
    //--------------------------------------------------------------------------
	for(new i = 0; i <= MAX_HOUSES; i++)
	{
	    DestroyPickup(HousePickup[i]);
	}
	//--------------------------------------------------------------------------
	BuildCreatedVehicle = (BuildCreatedVehicle == 0x01) ? (DestroyVehicle(BuildVehicle), BuildCreatedVehicle = 0x00) : (DestroyVehicle(BuildVehicle), BuildCreatedVehicle = 0x00);
	KillTimer(rCounter);
	KillTimer(CountTimer);
	Loop(i, MAX_PLAYERS)
	{
		DisablePlayerRaceCheckpoint(i);			PlayerTextDrawDestroy(i, RInfo[i][0]);
		PlayerTextDrawDestroy(i, RInfo[i][1]);	PlayerTextDrawDestroy(i, RInfo[i][2]);
		PlayerTextDrawDestroy(i, RInfo[i][3]);	PlayerTextDrawDestroy(i, RInfo[i][4]);
		PlayerTextDrawDestroy(i, RInfo[i][5]);	PlayerTextDrawDestroy(i, RInfo[i][6]);
		PlayerTextDrawDestroy(i, RInfo[i][7]);	DestroyVehicle(CreatedRaceVeh[i]);
		Joined[i] = false;						KillTimer(InfoTimer[i]);
	}
	JoinCount = 0;
	FinishCount = 0;
	return 1;
}
Can anyone help me with this problems?
Thank you.

Sorry for my bad English .
Reply
#2

Up .
Reply
#3

Compile with the -d3 flag for more debug info (line number specifically).

Also you should really refrain from having multiple statements on lines. It looks extremely cluttered and is difficult to read.

Also that ternary operator line seems to not do anything (both result from the condition do the same thing).
Reply
#4

What is -d3 flag ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)