SA-MP Forums Archive
why am i registering once again after restarting the server? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: why am i registering once again after restarting the server? (/showthread.php?tid=633445)



why am i registering once again after restarting the server? - Oshery - 01.05.2017

title**
after i restart the server through my control panel (not through a cmd /gmx and such as) im being forced to register after im registered already.
in my mysql server i can see that i have another ID created with the same UserName
for examle, im registering with the name Royal then i restart the server and im being forced to register again with the same name i registered already, with using another ID
here is my register sys
Код:
   TogglePlayerSpectating(playerid, 1);
   	mysql_format(mysql, query, sizeof(query), "SELECT * FROM `users` WHERE `Name` = '%e'",pInfo[playerid][Name]);
	mysql_query(mysql, query);
	new rows = cache_num_rows();
	if(rows == 1)
	{
		PlayAudioStreamForPlayer(playerid, "https://*******/HkZO0N");
		ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_PASSWORD, "Login..","Welcome! Please Enter Your Password To Login","Login","Cancel");
	}
	else if(rows == 0)
	{
	    PlayAudioStreamForPlayer(playerid, "https://*******/bRXYbG");
	    ShowPlayerDialog(playerid, REGISTER_DIALOG, DIALOG_STYLE_INPUT, "Register..","Welcome! Please Enter Your Password To Register","Register","Cancel");
	}



Re: why am i registering once again after restarting the server? - Andre02 - 01.05.2017

You have to query it to a new callback, so you would have to do this:

PHP код:

    TogglePlayerSpectating
(playerid1);
    
mysql_format(mysqlquerysizeof(query), "SELECT * FROM `users` WHERE `Name` = '%e'",pInfo[playerid][Name]);
    
mysql_query(mysqlquery"CheckPlayerCallback""i"playerid); // Here I'm sending the query results to CheckPlayerCallback and running it.
forward CheckPlayerCallback(playerid);
public 
CheckPlayerCallback(playerid)
{
    if(
cache_num_rows == 1// You don't need "new rows", as CheckPlayerCallback already has all the info needed sent by the query, and cache_num_rows is now checking it.
    
{
        
PlayAudioStreamForPlayer(playerid"https://*******/HkZO0N");
        
ShowPlayerDialog(playeridLOGIN_DIALOGDIALOG_STYLE_PASSWORD"Login..","Welcome! Please Enter Your Password To Login","Login","Cancel");
    }
    else if(
cache_num_rows == 0)
    {
        
PlayAudioStreamForPlayer(playerid"https://*******/bRXYbG");
        
ShowPlayerDialog(playeridREGISTER_DIALOGDIALOG_STYLE_INPUT"Register..","Welcome! Please Enter Your Password To Register","Register","Cancel");
    } 



Re: why am i registering once again after restarting the server? - Oshery - 01.05.2017

ive done that thank you but im getting that compile error
Quote:

(936) : error 035: argument type mismatch (argument 3)

Код:
mysql_query(mysql, query, "CheckPlayerCallback", "i", playerid); // Here I'm sending the query results to CheckPlayerCallback and running it.



Re: why am i registering once again after restarting the server? - Andre02 - 01.05.2017

Change mysql_query into mysql_tquery, my bad I didn't realize, I forgot that.


Re: why am i registering once again after restarting the server? - Oshery - 01.05.2017

i changed that but it still seems to be not working.
everything goes great in the compile but in game the same result, after restarting it will force me to register while ive registered an account under that name already


Re: why am i registering once again after restarting the server? - xPhantom - 02.05.2017

You are probably missing a field in your MySQL tables that your script is using. Check mysql_log.txt to see if that's the case, it will usually tell you.


Re: why am i registering once again after restarting the server? - Vince - 02.05.2017

Also put a unique index on the username column to at least prevent the duplicate entries.


Re: why am i registering once again after restarting the server? - Oshery - 02.05.2017

im a beginner i need a little bit help with doing that
EDIT: i've realized my issue and fixed it out, thanks anyone for the help appreciated!