Function Not Called (MySQL_Function_Query)
#1

CODE
Код:
public SafeOnPlayerConnect(playerid)
{
    SendClientMessage(playerid, WHITE, "[DEBUG]: MAU #1");
	CheckAccount(playerid);
	return 1;
}
public CheckAccount(playerid)
{	
    new query[82];

	format(query, sizeof(query), "SELECT `Username` FROM `accounts` WHERE `Username` = '%s'", PlayerName(playerid));
	mysql_function_query(handle, query, true, "OnAccountCheck", "d", playerid);
    SendClientMessage(playerid, WHITE, "[DEBUG]: Mau #2");
	return 1;
}
public OnAccountCheck(playerid)
{
	if(playerid != INVALID_PLAYER_ID) {

		new rows, fields;
		cache_get_data(rows, fields, handle);
		new string[250];
		for (new i = 1; i <= 50; i++) SendClientMessage(playerid, -1, " ");
        SendClientMessage(playerid, WHITE, "[DEBUG]: Mau #3");
		if(rows) {
			cache_get_row(0,2,PlayerInfo[playerid][pKey],handle, 128);
			format(string, sizeof(string), "Selamat Datang Kembali Di %s, %s.", SERVER_NAME, PlayerName(playerid));
			SendClientMessage(playerid, GREY, string);
            SendClientMessage(playerid, WHITE, "[DEBUG]: Show Dialog Login");
			SendClientMessage(playerid, WHITE, "That name is currently registered, please log into your account.");
			ShowMainMenuDialog(playerid, 1);
		}
		else {
			format(string, sizeof(string), "Selamat Datang Di %s, %s.", SERVER_NAME, PlayerName(playerid));
			SendClientMessage(playerid, GREY, string);
            SendClientMessage(playerid, WHITE, "[DEBUG]: Show Dialog Register");
			SendClientMessage(playerid, WHITE, "That name is currently not registered.");
			SendClientMessage(playerid, WHITE, "If you wish to register, please input your password in the box below.");
			ShowMainMenuDialog(playerid, 2);
		}
	}
	return 1;
}
And I am Set Timer in onplayerconnect
SetTimerEx("SafeOnPlayerConnect", 1000, 0, "d", playerid);

But OnAccountCheck not called.So Screen Like This

MySQL Log:
Код:
16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:29] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:30:29] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
[16:30:46] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:31:19] [ERROR] "mysql_tquery" - invalid connection handle. (ID = 0).
[16:31:19] [ERROR] "cache_get_data" - invalid connection handle. (ID = 1).
Question:
How To Fix It? Thanks
Reply
#2

What does the mysql log print?
Reply
#3

Where I Can Find It? I'm have check mysql_error_log.txt(Custom Script to write onqueryerror)
Reply
#4

What is your MySQL version? And change
pawn Код:
format(query, sizeof(query), "SELECT `Username` FROM `accounts` WHERE `Username` = '%s'", PlayerName(playerid));
    mysql_function_query(handle, query, true, "OnAccountCheck", "d", playerid);
with
pawn Код:
format(query, sizeof(query), "SELECT * FROM `accounts` WHERE `Username` = '%s'", PlayerName(playerid));
    mysql_function_query(handle, query, true, "OnAccountCheck", "d", playerid);
Reply
#5

It's on the main directory. It's on the same place where samp-server.exe is located at. If it failed for some reason, it would write the reason.
Reply
#6

When u have "mysql_debug(1)" in OnGameModeInit you can find your MySQL log in file Debug.txt, it's like server_log.txt

Edit: or in newest version it's "mysql_log(1-4)" and log is in file mysql_log.txt
Reply
#7

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
It's on the main directory. It's on the same place where samp-server.exe is located at. If it failed for some reason, it would write the reason.
I Have Check it.No Error founded
Reply
#8

Quote:
Originally Posted by WopsS
Посмотреть сообщение
What is your MySQL version? And change
pawn Код:
format(query, sizeof(query), "SELECT `Username` FROM `accounts` WHERE `Username` = '%s'", PlayerName(playerid));
    mysql_function_query(handle, query, true, "OnAccountCheck", "d", playerid);
with
pawn Код:
format(query, sizeof(query), "SELECT * FROM `accounts` WHERE `Username` = '%s'", PlayerName(playerid));
    mysql_function_query(handle, query, true, "OnAccountCheck", "d", playerid);
You realise you've worsened the query that way?

OT: Use print checks everywhere, see if the callback is being actually called.
Reply
#9

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
It's on the main directory. It's on the same place where samp-server.exe is located at. If it failed for some reason, it would write the reason.
I Have Check it.No Error founded
Reply
#10

Quote:
Originally Posted by WopsS
Посмотреть сообщение
What is your MySQL version? And change
pawn Код:
format(query, sizeof(query), "SELECT `Username` FROM `accounts` WHERE `Username` = '%s'", PlayerName(playerid));
    mysql_function_query(handle, query, true, "OnAccountCheck", "d", playerid);
with
pawn Код:
format(query, sizeof(query), "SELECT * FROM `accounts` WHERE `Username` = '%s'", PlayerName(playerid));
    mysql_function_query(handle, query, true, "OnAccountCheck", "d", playerid);
I Have change it.Still Same.Callback not called
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)