#1

Hi all, I get error: error 032: array index out of bounds (variable "kod")
line:
Код:
if(kod[10] == adalis)
All code:
Код:
	if(dialogid == 250)
	{
	    if(response)
	    {
			adalis = strval(inputtext);
			new zin[20],querys[100],kod[10];
			format(zin,sizeof(zin),"%d ir %d",pdalis,adalis);
			SendClientMessage(playerid,BALTA,zin);
			format( querys, 128, "SELECT Kodas FROM `namai` WHERE id = '%i'",pdalis);
			mysql_query( querys );
			mysql_store_result();
			mysql_retrieve_row();
			mysql_fetch_field_row( querys, "Kodas" );
			format( kod, 10, "%d", querys ) ;

	        mysql_free_result();
	        SendClientMessage(playerid,BALTA,querys);
	        if(kod[10] == adalis)
	        {
	            SendClientMessage(playerid,BALTA,"Sutinka");
	        }
	        else
	        {
	            SendClientMessage(playerid,BALTA,"Nesutinka");
	        }
	    }
	    if(!response)
	    {
	    }
	}
Reply
#2

I suposse that's a string,AND you cannot compare 2 strings like that,use strcmp.That stands for string compare.
Reply
#3

Please example.
Reply
#4

The problem is that if you do: kod[10], the system believes that you are trying to access position 10 in the string, and you only have 0-9 positions in a 10 char string.

you should do this:
if(strval(kod) == adalis)
Reply
#5

Removed,due to unuseful answer,sorry.
Reply
#6

He is trying to compare two integers, not two strings, just check his code
Reply
#7

My bad,you're right,sorry deimantas,and yes,Siralos is right...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)