21.07.2018, 20:39
How can I get the return value of a MySQL tquery callback?
In non async query:
How do I do this with the async version?
Thanks in advance!
In non async query:
Код:
public OnPlayerRequestClass(playerid, classid)
{
// Check if the name is on our database
// If it is -> Show login dialog
// If not -> Tell client to register on site + kick
if (!NameCheck(playerid)) return KickPlayer(playerid, "This name is not on our Database. Please register on our website: custom-roleplay.com");
return 1;
}
public NameCheck(playerid) {
new name[MAX_PLAYER_NAME + 1];
GetPlayerName(playerid, name, sizeof(name));
new query[128];
mysql_format(Database, query, sizeof query, "SELECT * FROM users WHERE name = '%s'", name);
mysql_query(Database, query);
if (cache_num_rows() > 0) {
return true;
}
return false;
}
Thanks in advance!


