MySQL threaded query how to get it's return?
#2

Just create a callback and do shit there rather than on player class selection. Waiting for the query to complete makes threading useless (tquery and waiting for the query to complete for the result)
Код:
public OnPlayerRequestClass(playerid, classid)
{
    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_tquery(Database, query, "OnPlayerNameCheck", "i", playerid);
	return 1;
}

forward public OnPlayerNameCheck(playerid);
public OnPlayerNameCheck(playerid)
{
	if(cache_num_rows() > 0)
	{
		ShowPlayerCharacterSleection or whatever();
		// name exist
	}
	else
	{
	    SendClientMessage(playerid, color_red, "this account doesnt exist....");
	    // name doesnt exist
  	}
	return 1;
}
Reply


Messages In This Thread
MySQL threaded query how to get it's return? - by Seifspeed - 21.07.2018, 20:39
Re: MySQL threaded query how to get it's return? - by MafiaOink - 21.07.2018, 20:52
Re: MySQL threaded query how to get it's return? - by Seifspeed - 21.07.2018, 20:58
Re: MySQL threaded query how to get it's return? - by Banditul18 - 21.07.2018, 21:31

Forum Jump:


Users browsing this thread: 3 Guest(s)