/members out of bounds
#1

My command /members works only on few factions, IDK why one some doesn't...

Код:
CMD:members( playerid ){
	if( playerVariables[ playerid ][ pGroupRank ] < 6 ) return SendClientMessage( playerid, -1, "Faction: You can't acces this command");
	new szString[ 1500 ], szQuery[ 512 ], g_ID = playerVariables[ playerid ][ pGroup ], Cache: r, szName[ MAX_PLAYER_NAME ], g_Rank, g_FW, g_Days;
	format( szString, sizeof( szString ), "{FFB300}%s {FFFFFF}members: \n", groupVariables[ g_ID ][ gGroupName ] );
	format( szQuery, sizeof( szQuery ), "SELECT * FROM `playeraccounts` WHERE `playerGroup` = %d ORDER BY `playerGroupRank` DESC", g_ID );
	r = mysql_query( handle, szQuery );
	for( new i = 0; i < cache_get_row_count( handle ); i++ ){
	    cache_get_field_content( i, "playerName", szName, handle, MAX_PLAYER_NAME );
	    format( Selected[ i + 1 ][ snume ], MAX_PLAYER_NAME, szName );
		g_Rank = cache_get_field_content_int( i, "playerGroupRank", handle );
		g_FW = cache_get_field_content_int( i, "playerFWarns", handle );
		g_Days = cache_get_field_content_int( i, "playerDays", handle );
		format( szString, sizeof( szString ), "%s %s - Rank: %d - FW: %d/3 - %s - %d\n", szString, szName, g_Rank, g_FW, ( GetPlayerID( szName ) == INVALID_PLAYER_ID ) ? ( "offline" ) : ( "online" ), g_Days );
	}
	cache_delete( r );
	ShowPlayerDialog( playerid, DIALOG_MEMBERS, DIALOG_STYLE_LIST, "Members", szString, "Select", "Cancel" );
	return 1;
	
}
Код:
[09:38:04] [debug] Run time error 4: "Array index out of bounds"
[09:38:04] [debug]  Accessing element at index 10 past array upper bound 9
[09:38:04] [debug] AMX backtrace:
[09:38:04] [debug] #0 00179d54 in public cmd_members (playerid=0, ... <1 argument>) at E:\x\x\gamemodes\x.pwn:26238
[09:38:04] [debug] #1 native CallLocalFunction () from samp03svr
[09:38:04] [debug] #2 00000b1c in public OnPlayerCommandText (playerid=0, cmdtext[]=@0035f32c "/members") at E:\x\x\pawno\include\zcmd.inc:102
26238 is format( Selected[ i + 1 ][ snume ], MAX_PLAYER_NAME, szName );
Reply


Messages In This Thread
/members out of bounds - by TheWay - 02.05.2015, 06:35
Re: /members out of bounds - by Threshold - 02.05.2015, 07:31
Re: /members out of bounds - by TheWay - 02.05.2015, 07:44
Re: /members out of bounds - by Mencent - 02.05.2015, 09:29
Re: /members out of bounds - by Threshold - 02.05.2015, 14:24
Re: /members out of bounds - by sammp - 02.05.2015, 14:39

Forum Jump:


Users browsing this thread: 1 Guest(s)