#1

Hello there friends, i'm FaLLenGirL.
I need some little help with this problem:


Error in the console:
[16:27:17] [debug] Run time error 4: "Array index out of bounds"
[16:27:17] [debug] Accessing element at index 10 past array upper bound 6
[16:27:17] [debug] AMX backtrace:
[16:27:17] [debug] #0 00090318 in ?? (0) from ISF.amx
[16:27:17] [debug] #1 0002faac in public OnPlayerSpawn (0) from ISF.amx


OnPlayerSpawn Public:
Код:
public OnPlayerSpawn( playerid )
{
        new ServerHour, ServerMinute, ServerSecond;
	gettime( ServerHour, ServerMinute, ServerSecond );
	
	SetupPlayerForGang( playerid, PlayerInfo[ playerid ][ GangID ] );
	Attach3DTextLabelToPlayer( PlayerState[ playerid ], playerid, 0.0, 0.0, 0.5 );
        ShowZonesForPlayer( playerid );
        HideClassTD( playerid );
	God_Mode_Verify( playerid );
        SetPlayerInterior( playerid, 0 );
	SetPlayerSpecialAction( playerid, 0 );
	SetPlayerTime( playerid, ServerHour, 0 );
	SetPlayerVirtualWorld( playerid, 0 );
 	CSpeedStats[ playerid ] = 1;
 	HideIntroTextdraws( playerid );
        Jail_EvadeCheck( playerid );
	Freeze_EvadeCheck( playerid );
	CheckDMInfo( playerid );
	
	PlayerInfo[ playerid ][ InDerby ] = 0;
	if( PlayerInfo[ playerid ][ UseSkin ] == 1 )
		SetPlayerSkin( playerid, PlayerInfo[ playerid ][ FavSkin ] );
		
        if( PlayerInfo[ playerid ][ HideTDS ] == 0 )
		ShowSpawnTextdraws( playerid );
		
        if( PlayerInfo[ playerid ][ InMG ][ 0 ] == 1 )
    	        SetPlayerPos( playerid, - 786.646484, 2300.745849, 66.580314 );
    	
    return 1;
}
Please, if someone can help me, reply.
You also can contact me on, skype: cristina.muresan35.
Reply
#2

Can you insert declarations of PlayerInfo with structure and CSpeedStats?
And, if you can, please run this code and show logs.
Код:
public OnPlayerSpawn( playerid )
{
        new ServerHour, ServerMinute, ServerSecond;
	gettime( ServerHour, ServerMinute, ServerSecond );
	
        print("OnPlayerSpawn was called");
	SetupPlayerForGang( playerid, PlayerInfo[ playerid ][ GangID ] );
	Attach3DTextLabelToPlayer( PlayerState[ playerid ], playerid, 0.0, 0.0, 0.5 );
        ShowZonesForPlayer( playerid );
        HideClassTD( playerid );
	God_Mode_Verify( playerid );
        SetPlayerInterior( playerid, 0 );
	SetPlayerSpecialAction( playerid, 0 );
	SetPlayerTime( playerid, ServerHour, 0 );
	SetPlayerVirtualWorld( playerid, 0 );
        print("First breakpoint");
 	CSpeedStats[ playerid ] = 1;
 	HideIntroTextdraws( playerid );
        Jail_EvadeCheck( playerid );
	Freeze_EvadeCheck( playerid );
	CheckDMInfo( playerid );
        print("Second breakpoint");
	
	PlayerInfo[ playerid ][ InDerby ] = 0;
	if( PlayerInfo[ playerid ][ UseSkin ] == 1 )
		SetPlayerSkin( playerid, PlayerInfo[ playerid ][ FavSkin ] );
		
        print("Third breakpoint");
        if( PlayerInfo[ playerid ][ HideTDS ] == 0 )
		ShowSpawnTextdraws( playerid );
		
        print("Fourth breakpoint");
        if( PlayerInfo[ playerid ][ InMG ][ 0 ] == 1 )
    	        SetPlayerPos( playerid, - 786.646484, 2300.745849, 66.580314 );
    	
        print("End of OnPlayerSpawn");
    return 1;
}
By printing we'll point of error.
Reply
#3

Posting OnPlayerSpawn doesn't really help because the problem is #0 00090318 in ?? (0). In other words, it could be in any of the functions below. To get more detailed information, compile with the -d3 debug flag.

PHP код:
ShowZonesForPlayerplayerid );
HideClassTDplayerid );
God_Mode_Verifyplayerid );
HideIntroTextdrawsplayerid );
Jail_EvadeCheckplayerid );
Freeze_EvadeCheckplayerid );
CheckDMInfoplayerid );
ShowSpawnTextdrawsplayerid ); 
I'm also wondering how many topics with this exact title are created daily. Yes, we know you need help. This forum is called Scripting Help for crying out loud. Choose a proper title. It can't be that hard.
Reply
#4

Well, i compiled with -d3 and nothing happened.
But when i compiled with Desaints prints:

Код:
public OnPlayerSpawn( playerid )
{
        new ServerHour, ServerMinute, ServerSecond;
	gettime( ServerHour, ServerMinute, ServerSecond );
	
        print("OnPlayerSpawn was called");
	SetupPlayerForGang( playerid, PlayerInfo[ playerid ][ GangID ] );
	Attach3DTextLabelToPlayer( PlayerState[ playerid ], playerid, 0.0, 0.0, 0.5 );
        ShowZonesForPlayer( playerid );
        HideClassTD( playerid );
	God_Mode_Verify( playerid );
        SetPlayerInterior( playerid, 0 );
	SetPlayerSpecialAction( playerid, 0 );
	SetPlayerTime( playerid, ServerHour, 0 );
	SetPlayerVirtualWorld( playerid, 0 );
        print("First breakpoint");
 	CSpeedStats[ playerid ] = 1;
 	HideIntroTextdraws( playerid );
        Jail_EvadeCheck( playerid );
	Freeze_EvadeCheck( playerid );
	CheckDMInfo( playerid );
        print("Second breakpoint");
	
	PlayerInfo[ playerid ][ InDerby ] = 0;
	if( PlayerInfo[ playerid ][ UseSkin ] == 1 )
		SetPlayerSkin( playerid, PlayerInfo[ playerid ][ FavSkin ] );
		
        print("Third breakpoint");
        if( PlayerInfo[ playerid ][ HideTDS ] == 0 )
		ShowSpawnTextdraws( playerid );
		
        print("Fourth breakpoint");
        if( PlayerInfo[ playerid ][ InMG ][ 0 ] == 1 )
    	        SetPlayerPos( playerid, - 786.646484, 2300.745849, 66.580314 );
    	
        print("End of OnPlayerSpawn");
    return 1;
}
he stopped at ShowZonesForPlayer because other functions below doesn't respond.

Console:
[22:37:35] OnPlayerSpawn was called
[22:37:35] [debug] Run time error 4: "Array index out of bounds"
[22:37:35] [debug] Accessing element at index 10 past array upper bound 6
[22:37:35] [debug] AMX backtrace:
[22:37:35] [debug] #0 000903e4 in ?? (0) from ISF.amx

and that's all what show's to me in console.
if i use -d3 nothing happen in console. ( in addition ).

That's showzonesforplayer stock:
Код:
stock ShowZonesForPlayer( playerid )
{
	for( new i = 1; i < MAX_GANGS; i ++ )
 	{
		GangZoneShowForPlayer( playerid, Teritories[ i ][ ID ], Colors[ GangInfo[ Teritories[ i ][ owner ] ][ GangColor ] ] );
	}
	return 1;
}
Colors is defined like:
Код:
new Colors[ ] =
{
	0x9900FFAA, //Gang ID: 1 | Color ID: 0 | Gang Name: The Ballas
	0x55FF00AA, //Gang ID: 2 | Color ID: 1 | Gang Name: Grove Street Families
	0xCC00FFAA, //Gang ID: 3 | Color ID: 2 | Gang Name: The Triads
	0xFF9900AA, //Gang ID: 4 | Color ID: 3 | Gang Name: The Hitmans
	0x00DDFFAA, //Gang ID: 5 | Color ID: 4 | Gang Name: Varios Los Aztecas
	0x0064FFAA, //Gang ID: 6 | Color ID: 5 | Gang Name: San Fierro Rifa
	0xFFFF00AA, //Gang ID: 7 | Color ID: 6 | Gang Name: Los Santos Vagos
};
Teritories is defined like:
Код:
new Teritories[ MAX_GANGS ][ TersData ];
and enum TersData is this:
Код:
enum TersData
{
	Float:minx,
	Float:miny,
	Float:maxx,
	Float:maxy,
	owner,
	ID,
	bool:turfing,
	turfingby
};
I think here is the problem in showzonesforplayer stock, but i don't realize what's the problem..
Maybe Colors it's not ok defined or something, please rep.

EDIT:

I changed ShowZonesForPlayer from stock to function and now in the console show this:
Код:
[23:16:31] OnPlayerSpawn was called
[23:16:31] [debug] Run time error 4: "Array index out of bounds"
[23:16:31] [debug]  Accessing element at index 10 past array upper bound 6
[23:16:31] [debug] AMX backtrace:
[23:16:31] [debug] #0 000903e4 in public ShowZonesForPlayer (0) from ISF.amx
[23:16:31] [debug] #1 0002fad0 in public OnPlayerSpawn (0) from ISF.amx
Reply
#5

Upppppp
Reply
#6

Someone ? XD
Reply
#7

How did you defined MAX_GANGS?
Has every teritory valid owner?
Doesn't any gang GangColor set to 7 or above, especially 10? ("index 10 past array upper bound 6" - so try to check / delete / set GangColor for GangInfo to 0, I'm almost sure, that "array upper bound 6" refers to Colors[]).

If everything seems to be ok, last chance can be trying to validate by printf.
Код:
                printf("Loop number %d, teritory ID: %d",i,Teritories[ i ][ ID ]);
                printf("owner: %d; owner's colorid: %d", GangInfo[ Teritories[ i ][ owner ] ][ GangColor ]);
                printf("color: %x",Color[GangInfo[ Teritories[ i ][ owner ] ][ GangColor ]]);
		GangZoneShowForPlayer( playerid, Teritories[ i ][ ID ], Colors[ GangInfo[ Teritories[ i ][ owner ] ][ GangColor ] ] );
Imo this should crash after owner and owner's colorid, it would be easier to check is this valid value.
Reply
#8

MAX_GANGS is defined like:
Код:
#define MAX_GANGS 8
Printfs shows me this in the console:
Код:
[20:04:19] Loop number 1, teritory ID: 0
[20:04:19] owner: 0; owner's colorid: 
[20:04:19] color: 9900FFAA
[20:04:19] Loop number 2, teritory ID: 1
[20:04:19] owner: 1; owner's colorid: 
[20:04:19] color: 55FF00AA
[20:04:19] Loop number 3, teritory ID: 2
[20:04:19] owner: 2; owner's colorid: 
[20:04:19] color: CC00FFAA
[20:04:19] Loop number 4, teritory ID: 3
[20:04:19] owner: 3; owner's colorid: 
[20:04:19] color: FF9900AA
[20:04:19] Loop number 5, teritory ID: 4
[20:04:19] owner: 4; owner's colorid: 
[20:04:19] color: DDFFAA
[20:04:19] Loop number 6, teritory ID: 5
[20:04:19] owner: 5; owner's colorid: 
[20:04:19] color: 64FFAA
[20:04:19] Loop number 7, teritory ID: 6
[20:04:19] owner: 6; owner's colorid: 
[20:04:19] color: FFFF00AA
Yes every teritory has a valid owner.

EDIT:
When i was on my laptop that error appeared.
But now i'm on my PC and everything works fine.. lol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)