Undefined playerid, wtf? -
abyss. - 27.02.2015
(6782

: error 017: undefined symbol "playerid"
(67831) : error 017: undefined symbol "playerid"
67828: GetPlayerName(playerid, name, sizeof (name));
67831: setarg(paramPos, 0, playerid);
From this stock:
http://pastebin.com/TD8GRhBk
Why?
I get this error only if i put this publics:
Код:
public MySQLLoadCars(sqlplayerid, sqlvalname[], sqlresult[])
{
new query[128];
format(query, sizeof(query), "SELECT %s FROM cars WHERE id = %d LIMIT 1", sqlvalname, sqlplayerid);
mysql_query(query);
mysql_store_result();
if(mysql_fetch_row(sqlresult)==1)
{
return 1;
}
return 0;
}
public LoadCar()
{
new Query[255];
mysql_query("SELECT * FROM cars"); // Querys the "Query" Variable.
mysql_store_result(); // Stores the result from Query
personalcars = mysql_num_rows();
new masini=0;
for(new idx = 1; idx <= personalcars; idx++)
{
format(Query, sizeof(Query), "SELECT * FROM cars WHERE id = '%d'", idx);
mysql_query(Query); // Querys the "Query" Variable.
mysql_store_result(); // Stores the result from Query
if(mysql_num_rows()) // Checks if theres anyrow.
if(mysql_fetch_row_format(Query,"|")) // Splits the row
{
sscanf(Query, "p<|>e<iiffffffffiis[64]s[64]iiiiis[255]iiiiiiiiiiiiiii>",CarData[idx]);
masini++;
}
//printf("id %d car model %d, cLocationx %f, cNum %s, cSaAngle %f, cComponent13 %d",idx, CarData[idx][cModel],CarData[idx][cLocationx],CarData[idx][cNum],CarData[idx][cSaAngle], CarData[idx][cComponent01]);
}
printf("-Masini citite: %d", masini);
return 1;
}
Sometimes when i get those random errors i find that is from a { or } but this time the number of { and } are equal.
Re: Undefined playerid, wtf? -
awoo - 27.02.2015
Код:
GetPlayerName(playerid, name, sizeof (name));
setarg(paramPos, 0, playerid);
to:
Код:
GetPlayerName(i, name, sizeof (name));
setarg(paramPos, 0, i);
Re: Undefined playerid, wtf? -
CalvinC - 27.02.2015
You're using it in a loop, that loops through all players, then defines them as "i", therefore you should use "i", not "playerid".
Also, as you can see in the function title:
pawn Код:
stock sscanf(string[], format[], {Float,_}:...)
There's no "playerid" parameter, so you cannot use it, but in this case you should use "i" anyways.
Re: Undefined playerid, wtf? -
abyss. - 27.02.2015
Thx guys, that worked. Now i get it.
Btw, do you know why my personalcars dont load? :-/ They are saved in cars, i can park them, everything but with those publics over ther they dont load on server and dunno why. I think its something from the id of the car but dont get it :-/. First id of the personalcars is 540.