error 006: must be assigned to an array
#1

This is my code:
Код:
new buycars[500];
enum cars
{
	modelid,
	carname,
	price
}
new BuyCarsAll[128][cars];

main( ) { }


public OnGameModeInit()
{
    mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password);
	new query[300], savingstring[200], id;
	query = "SELECT * FROM cars";
	mysql_query(query); 
	mysql_store_result();
	while(mysql_fetch_row_format(query,"|"))
	{
		id = id+1;
		mysql_fetch_field_row(savingstring, "modelid");
		BuyCarsAll[id][modelid] = savingstring;
		mysql_fetch_field_row(savingstring, "price");
		BuyCarsAll[id][price] = savingstring;
		mysql_fetch_field_row(savingstring, "carname");
		BuyCarsAll[id][carname] = savingstring;
		format(savingstring, sizeof(savingstring), "%s\n", savingstring);
		strins(buycars, savingstring, strlen(buycars));
	}
	mysql_free_result();
	strdel(buycars, strlen(buycars)-1, strlen(buycars)); 
}
I got this error
Код:
C:\Users\sianbg\Desktop\compiler samp race\pawno\race.pwn(46) : error 006: must be assigned to an array
C:\Users\sianbg\Desktop\compiler samp race\pawno\race.pwn(48) : error 006: must be assigned to an array
C:\Users\sianbg\Desktop\compiler samp race\pawno\race.pwn(50) : error 006: must be assigned to an array
C:\Users\sianbg\Desktop\compiler samp race\pawno\race.pwn(453) : warning 203: symbol is never used: "OnPlayerCommandPerformed"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#2

Код:
This forum requires that you wait 240 seconds between posts. Please try again in 124 seconds.
Which lines are exactly 46/48/50 ?
Reply
#3

Quote:
Originally Posted by x96664
Посмотреть сообщение
Код:
This forum requires that you wait 240 seconds between posts. Please try again in 124 seconds.
Which lines are exactly 46/48/50 ?
BuyCarsAll[id][modelid] = savingstring; - 46 line
BuyCarsAll[id][price] = savingstring; - 48 line
BuyCarsAll[id][carname] = savingstring; - 50 line
Reply
#4

Assuming modelid and price should stay integers and only carname should be a string.
pawn Код:
enum cars
{
    modelid,
    carname[32],
    price
}
pawn Код:
mysql_fetch_field_row(savingstring, "modelid");
BuyCarsAll[id][modelid] = strval(savingstring);
mysql_fetch_field_row(savingstring, "price");
BuyCarsAll[id][price] = strval(savingstring);
mysql_fetch_field_row(savingstring, "carname");
strcpy(BuyCarsAll[id][carname], savingstring, 32);
pawn Код:
#define strcpy(%0,%1,%2) strcat((%0[0] = '\0', %0), %1, %2)
By the way, reduce savingstring. 200 is too much.
Reply
#5

@Konstantinos - Make sure you're actually commenting what you've fixed and where you fixed it so he will know in the future same with other people, otherwise you're giving out help but not actaully helping.
Reply
#6

ty @Konstantinos
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)