SA-MP Forums Archive
Load cars from database error - 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: Load cars from database error (/showthread.php?tid=607997)



Load cars from database error - justjamie - 26.05.2016

Hello.
When i compile this:
PHP код:
forward ToLoadCars(playerid);
public 
ToLoadCars(playerid);
{
new 
num_fields2,num_rows2;
cache_get_data(num_rows2,num_fields2,dbhandle);
if(
num_rows2==1)
{
for(new 
0sizeof(cInfo); i++)
{
cInfo[i][db_id] = cache_get_field_content_int(0,"id",dbhandle);
}
else
{
return 
1;
}

i get this error:
error 021: symbol already defined: "cache_get_data"

?? where does it come from


Re: Load cars from database error - justjamie - 26.05.2016

Quote:
Originally Posted by justjamie
Посмотреть сообщение
Hello.
When i compile this:
PHP код:
forward ToLoadCars(playerid);
public 
ToLoadCars(playerid);
{
new 
num_fields2,num_rows2;
cache_get_data(num_rows2,num_fields2,dbhandle);
if(
num_rows2==1)
{
for(new 
0sizeof(cInfo); i++)
{
cInfo[i][db_id] = cache_get_field_content_int(0,"id",dbhandle);
}
else
{
return 
1;
}

i get this error:
error 021: symbol already defined: "cache_get_data"

?? where does it come from
ok i changed this:
PHP код:
public ToLoadCars(playerid); 
to this:
PHP код:
public ToLoadCars(playerid
Now i get a fuckton of errors.
What did i do wrong?
It will compile perfectly when i remove this code.


Re: Load cars from database error - Konstantinos - 26.05.2016

Код:
public ToLoadCars(playerid);
Semicolons cannot be used at the end of a public function.

EDIT: You found out about that. Anyway, you're missing a closed bracket } too.


Re: Load cars from database error - iKevin - 26.05.2016

Show the errors and show the exact lines in which you get a specified error in.


Re: Load cars from database error - justjamie - 26.05.2016

Quote:
Originally Posted by justjamie
Посмотреть сообщение
Hello.
When i compile this:
PHP код:
forward ToLoadCars(playerid);
public 
ToLoadCars(playerid);
{
new 
num_fields2,num_rows2;
cache_get_data(num_rows2,num_fields2,dbhandle);
if(
num_rows2==1)
{
for(new 
0sizeof(cInfo); i++)
{
cInfo[i][db_id] = cache_get_field_content_int(0,"id",dbhandle);
}
else
{
return 
1;
}

i get this error:
error 021: symbol already defined: "cache_get_data"

?? where does it come from
Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Код:
public ToLoadCars(playerid);
Semicolons cannot be used at the end of a public function.

EDIT: You found out about that. Anyway, you're missing a closed bracket } too.
welp i see it XD.

my bad

saved my day <3