• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Plugin] help with mysql plugin error
#1
The error log

Code:
cache_delete:?invalid?cache?id?'0'




This is my Pawn Code:

Code:
CMD:actorlist(playerid, params[])

{

new list[1024], skin, Float:AcX, Float:AcY, Float:AcZ, id, Descriptions[48];

new query[1024];

new Cache: actorlist;

mysql_format(SQLHandle, query, sizeof(query), "SELECT * FROM `actor`");

mysql_query(SQLHandle, query);

new rows = cache_num_rows();

if(rows)

{

format(list, sizeof(list), "ID\tSkin\tDescriptions\tDistance\n");

for(new i; i < rows; )

{

cache_get_value_name_int(i, "ID", id);

cache_get_value_name_int(i, "SkinID", skin);

cache_get_value_name_float(i,"X", AcX);

cache_get_value_name_float(i,"Y", AcY);

cache_get_value_name_float(i,"Z", AcZ);

cache_get_value_name(i,"Descriptions", Descriptions);

new Float: distance = GetPlayerDistanceFromPoint(playerid, AcX, AcY, AcZ);

format(list, sizeof(list), "%s%d\t%d\t%s\t%.2f\n", list, id, skin, Descriptions, distance);

}

ShowPlayerDialog(playerid, DIALOG_ACTOR_LIST, DIALOG_STYLE_TABLIST_HEADERS, "Actor List Manager", list, "Manage", "Close");

}

else

{

SendClientMessage(playerid, COLOR_GREY, "ERROR: There's no Actor list on server");

return 1;

}

cache_delete(actorlist);

return 1;

}





The system is works perfectly but why it's giving error?
  Reply
#2
It's not working perfectly because you're not deleting the cache.



Code:
actorlist = mysql_query(SQLHandle, query);
Using Pawn.CMD?

If you're doing so, this is the very first sign that you absolutely shouldn't utilize your all powerful P-Code knowledge in any of the scripting discussion topics.
  Reply
#3
What Pinch said.



Quote:cache_delete: invalid cache id '0'

Invalid cache occurs when the cache doesn't exist. This can be because a wrong cache id was used (which is so in your case, because you never set the cache id to variable "actorlist") or if there is are no results from your query.
  Reply


Forum Jump: