SA-MP Forums Archive
error 033: array must be indexed - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: error 033: array must be indexed (/showthread.php?tid=400367)



error 033: array must be indexed - ancezas - 18.12.2012

I wrote this code:

Код:
new
		IPz[ 20 ],
		zIP[ 20 ]
	;
    mysql_fetch_field_row( fetch,"nolog" );      playerDB[ playerid ][ nolog ] = strval(fetch);
    mysql_get_field( "IP", IPz );
    new IPAS = GetPlayerIp(playerid,zIP,20);
	if( playerDB[ playerid ][ nolog ] == 1 )
	{
  		if( IPAS == IPz )
		{
 			SendClientMessage(playerid,COLOR,"Fucking veikia");
 			return 1;
		}
	}
but i have this error:

Код:
: error 033: array must be indexed (variable "IPz")
on this line:
Quote:

if( IPAS == IPz )




Re: error 033: array must be indexed - iWhite - 18.12.2012

Код:
if(!strcmp(IPAS, IPz, true))
!LukniS!


Re: error 033: array must be indexed - Konstantinos - 18.12.2012

Strcmp
You cannot compare string like you do in integers.


Re: error 033: array must be indexed - gtakillerIV - 18.12.2012

You are comparing two strings with each other,so use strcmp https://sampwiki.blast.hk/wiki/Strcmp


Re: error 033: array must be indexed - ancezas - 18.12.2012

Quote:

new
IPz[ 20 ],
zIP[ 20 ]
;
mysql_fetch_field_row( fetch,"nolog" ); playerDB[ playerid ][ nolog ] = strval(fetch);
mysql_get_field( "IP", IPz );
new IPAS = GetPlayerIp(playerid,zIP,20);
if( playerDB[ playerid ][ nolog ] == 1 )
{
if(!strcmp(IPAS, IPz, true))
{
SendClientMessage(playerid,COLOR,"Fucking veikia");
return 1;
}
}

I still don't get this

error 035: argument type mismatch (argument 1)


Re: error 033: array must be indexed - Yiin - 18.12.2012

Quote:
Originally Posted by ancezas
Посмотреть сообщение
I still don't get this

error 035: argument type mismatch (argument 1)
oh cmon ... thats not that hard.
pawn Код:
new
IPz[ 20 ],
zIP[ 20 ]
;
mysql_fetch_field_row( fetch,"nolog" ); playerDB[ playerid ][ nolog ] = strval(fetch);
mysql_fetch_field_row( IPz,"IP" );
GetPlayerIp(playerid,zIP,20);
if( playerDB[ playerid ][ nolog ] == 1 )
{
if(!strcmp(zIP, IPz, true))
{
SendClientMessage(playerid,COLOR,"Fucking veikia");
return 1;
}
}