SA-MP Forums Archive
Error 033: array must be indexed (variable "tmp2") - 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 (variable "tmp2") (/showthread.php?tid=609571)



Error 033: array must be indexed (variable "tmp2") - Sc0pion - 14.06.2016

Fixed!


Re: Error 033: array must be indexed (variable "tmp2") - iKarim - 14.06.2016

This should work.
PHP код:
new tmp2[16], savingstring[16];
format(query,sizeof(query), "SELECT IP FROM Accounts WHERE UserName='%s'"udb_encode(GetName(playerid)));
mysql_query(query);
mysql_store_result();
while(
mysql_fetch_row_format(query,"|"))
{
    
mysql_fetch_field_row(savingstring"IP"); 
    
strcat(tmp2savingstring);
}
mysql_free_result(); 



Re: Error 033: array must be indexed (variable "tmp2") - Stinged - 14.06.2016

Quote:
Originally Posted by PawnHunter
Посмотреть сообщение
This should work.
PHP код:
new tmp2[16], savingstring[16];
format(query,sizeof(query), "SELECT IP FROM Accounts WHERE UserName='%s'"udb_encode(GetName(playerid)));
mysql_query(query);
mysql_store_result();
while(
mysql_fetch_row_format(query,"|"))
{
    
mysql_fetch_field_row(savingstring"IP"); 
    
strcat(tmp2savingstring);
}
mysql_free_result(); 
Why do you even need tmp2 if you have savingstring?
But yes, that should work.


Re: Error 033: array must be indexed (variable "tmp2") - Sc0pion - 14.06.2016

Fixed!


Re: Error 033: array must be indexed (variable "tmp2") - iKarim - 14.06.2016

Because you're trying to assign an array without indexing.. I mean you can't do that:
PHP код:
new array[10];
array = 
0
but you can do that:
PHP код:
array[5] = 0