Threading queries. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Threading queries. (
/showthread.php?tid=490108)
Threading queries. -
Shetch - 25.01.2014
I just want to make sure I'm doing this right. I'm using BlueG's MySQL plugin and I am trying to thread queries. I have checked a lot of tutrials, but can't really seem to figure it out.
Код:
public OnPlayerConnect(playerid)
{
new query[128], name[MAX_PLAYER_NAME + 1];
GetPlayerName(playerid, name, sizeof(name));
mysql_format(mysql, query, sizeof(query), "SELECT * FROM `players` WHERE `username` = '%e' LIMIT 1", name);
mysql_tquery(mysql, query, "OnChechPlayerRegistered", "i", playerid);
return 1;
}
Код:
forward OnChechPlayerRegistered(playerid);
public OnChechPlayerRegistered(playerid)
{
new rows, fields;
cache_get_data(rows, fields);
if(rows == 0)
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Your username was not found in our database.\nPlease register by entering your password below.", "Confirm", "Cancel");
else
ShowPlayerDialog(playerid, DIALOG_LOG_IN, DIALOG_STYLE_PASSWORD, "Log In", "Your username was found in our database.\nPlease log in by entering your password below.", "Confirm", "Cancel");
printf("(Extraid: %i)", playerid);
return 1;
}
Re: Threading queries. -
maddinat0r - 25.01.2014
And where exactly is your problem? The code seems correct.
Re: Threading queries. -
Shetch - 25.01.2014
Quote:
Originally Posted by Shetch
I just want to make sure I'm doing this right.
|
4char