[MYSQ] Script not detecting username. - 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: [MYSQ] Script not detecting username. (
/showthread.php?tid=527471)
[MYSQ] Script not detecting username. -
Cole_William - 22.07.2014
Note: I'm really new with MYSQL so please give full explanations.
So i've been trying to get my script to understand that the field
"NAME" with the username
%s, GetName(playerid) will allow them to login, but it keeps sending them to register dialog.
Account Checking
pawn Код:
forward OnAccountCheck(playerid);
public OnAccountCheck(playerid)
{
new rows, fields;
cache_get_data(rows, fields, DB);
if(rows)
{
cache_get_field_content(0, "Name", GetName(playerid), DB, 129);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "In order to play, you need to login", "Login", "Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register", "In order to play, you need to register.", "Register", "Quit");
}
return 1;
}
Re: [MYSQ] Script not detecting username. -
Vince - 22.07.2014
If it shows the register dialog then it is fairly obvious that there aren't any rows returned. This may mean that your query is logically wrong or that there's simply nothing to retrieve to begin with. Also:
pawn Код:
cache_get_field_content(0, "Name", GetName(playerid), DB, 129);
What is this even? Makes no sense. At all.
Re: [MYSQ] Script not detecting username. -
Cole_William - 22.07.2014
Quote:
Originally Posted by Vince
If it shows the register dialog then it is fairly obvious that there aren't any rows returned. This may mean that your query is logically wrong or that there's simply nothing to retrieve to begin with. Also:
pawn Код:
cache_get_field_content(0, "Name", GetName(playerid), DB, 129);
What is this even? Makes no sense. At all.
|
The rows are fine, registering is fine but when i was to re-log the server wouldn't recognize the account being in there, also that get_content was an accident, forgot to remove it before posting the code.
What's your suggestion for a function to check if a user is registered or not?