MySQL problem
#1

pawn Код:
new Query[256];
format(Query, sizeof(Query), "SELECT `username` FROM `players` WHERE username = '%s' AND FMember = %d LIMIT %d", inputtext, PlayerInfo[playerid][pFMember], MAX_FAMILIES);
mysql_function_query(g_Handle, Query, true, "OnFamilyFire", "s[100]i", inputtext, playerid);
Hello again.. I'm using the code above in OnDialogResponse, but OnFamilyFire(the callback below) doesn't work. (mysql_log doesn't give any information from the queries from the OnFamilyFire callback)

pawn Код:
forward OnFamilyFire(name[], playerid);
public OnFamilyFire(name[], playerid)
{
    new Query[200];
    new rows, fields;
    cache_get_data(rows, fields);
    if(!rows)
    {
        ShowPlayerDialog(playerid, 999, DIALOG_STYLE_MSGBOX, "{00BC00}Meniul {F6F6F6}Familiei", "{00BC00}EROARE! {F6F6F6}Acel jucator nu este in familia ta sau nici nu exista!", "OK", "");
    }
    else
    {
        format(Query, sizeof(Query), "UPDATE `players` SET `FMember` = 255 WHERE username = '%s'", name);
        mysql_function_query(g_Handle, Query, false, "SendQuery", "");
        ShowPlayerDialog(playerid, 999, DIALOG_STYLE_MSGBOX, "{00BC00}Meniul {F6F6F6}Familiei", "{00BC00}Succes! {F6F6F6}Acel jucator a fost dat afara!", "OK", "");
    }
    return 1;
}
I believe the problem is from this line:
pawn Код:
mysql_function_query(g_Handle, Query, true, "OnFamilyFire", "s[100]i", inputtext, playerid);
Please, please help me!
Reply
#2

Check the msql debug and post the line's here. Let us see what's the problem!
Reply
#3

This is the debug:

pawn Код:
[14:36:17] >> mysql_real_escape_string( Connection handle: 1 )
[14:36:17] CMySQLHandler::EscapeString(xmlmx2); - Escaped 6 characters to xmlmx2.
[14:36:17] >> mysql_query_callback( Connection handle: 1 )
[14:36:17] Passing query SELECT `username` FROM `players` WHERE username = 'xmlmx2' AND FMember = 1 LIMIT 100 | s[100]i
[14:36:17] ProcessQueryThread(OnFamilyFire) - Query was successful. (SELECT `username` FROM `players` WHERE username = 'xmlmx2' AND FMember = 1 LIMIT 100)
[14:36:17] ProcessQueryThread(OnFamilyFire) - Data caching enabled.
[14:36:17] CMySQLHandler::StoreResult() - Result was stored.
[14:36:17] CMySQLHandler::FreeResult() - Result was successfully free'd.
[14:36:17] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[14:36:17] OnFamilyFire(s[100]i) - Threaded function called.
[14:36:17] >> cache_get_data( Connection handle: 1 )
[14:36:17] ProcessTick() - The cache has been cleared.
Reply
#4

That code works perfectly on my computer..
Did you try debugging it to see if the callback is even called?
Reply
#5

Seems like MySQL r7 doesn't work correctly with id 0. I fixed it creating an npc occupying id 0.
Reply
#6

R7 includes threaded queries to pass only and thats what you're exactly doing! Why dont you try it with R6 and change your code a bit. Try calling the function itself!
Reply
#7

Look at
Код:
"s[100]i"
this isn't sscanf.

Try changing it to
Код:
"si"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)