why am i registering once again after restarting the server?
#1

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");
	}
Reply
#2

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");
    } 
Reply
#3

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.
Reply
#4

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

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
Reply
#6

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.
Reply
#7

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

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!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)