PDA

View Full Version : [HELP] MySQL Registration Failure


AK47317
31/12/2011, 02:37 AM
hey guys im back from playing certain games and wanted back to script. In those case i have a little bit problem that i can't even figure out how to solve this. Hope you guys know how to solve this mysql registration failure.


public OnPlayerConnect ( playerid )
{
new pName [ MAX_PLAYER_NAME ] ;
SetPVarInt ( playerid , "Logged" , 0 ) ;
GetPlayerName ( playerid , pName , sizeof ( pName ) ) ;
format ( Query , sizeof ( Query ) , "SELECT * FROM `data` WHERE `Name` = '%s'" , pName ) ;
mysql_query ( Query ) ;
mysql_store_result ( ) ;
if ( mysql_num_rows ( ) == 1 )
{
format ( String , sizeof ( String ) , ""LIGHTGREEN"Enter your password to proceed" ) ;
ShowPlayerDialog ( playerid , DIALOG_LOGIN , DIALOG_STYLE_PASSWORD , DIALOG_TITLE , String , "Submit" , "" ) ;
}
else if ( mysql_num_rows ( ) == 0 )
{
format ( String , sizeof ( String ) , ""LIGHTGREEN"Enter your password to register" ) ;
ShowPlayerDialog ( playerid , DIALOG_REGISTER , DIALOG_STYLE_PASSWORD , DIALOG_TITLE , String , "Submit" , "" ) ;
}
mysql_free_result ( ) ;
return 1 ;
}



case DIALOG_REGISTER:
{
if ( response )
{
if ( strlen ( inputtext ) < 0 || strlen ( inputtext ) > 100 )
{
format ( String , sizeof ( String ) , ""LIGHTGREEN"You dont not enter any string or you just exceeding limit of password" ) ;
ShowPlayerDialog ( playerid , DIALOG_REGISTER , DIALOG_STYLE_PASSWORD , DIALOG_TITLE , String , "Submit" , "" ) ;
}
else
{
new pName [ MAX_PLAYER_NAME ] ;
GetPlayerName ( playerid , pName , sizeof ( pName ) ) ;
mysql_real_escape_string ( inputtext , inputtext ) ;
format ( Query , sizeof ( Query ) , "INSERT INTO `data` ( `Name` , `Level` , `Password` , `Kill` , `Death` , `Money` , `Score` ) VALUES( '%s' , 0 , '%s' , 0 , 0 , 10000 , 0 )" , pName , inputtext ) ;
mysql_query ( Query ) ;

SetPVarInt ( playerid , "Level" , 0 ) ;
SetPVarInt ( playerid , "Kill" , 0 ) ;
SetPVarInt ( playerid , "Death" , 0 ) ;
GivePlayerMoney ( playerid , 10000 ) ;
SetPlayerScore ( playerid , 0 ) ;
SetPVarInt ( playerid , "Logged" , 1 ) ;
}
}
return 1 ;
}


those are the codes for registration on mysql database.

[HiC]TheKiller
31/12/2011, 03:35 AM
mysql_debug(1);

under OnGameModeInit and then post your mysql_log file that is in your server directory.

AK47317
01/01/2012, 01:04 AM
Really? ive used that already


[11:31:48]

[11:31:48] ---------------------------

[11:31:48] MySQL Debugging activated (12/31/11)

[11:31:48] ---------------------------

[11:31:48]

[11:31:48] >> mysql_ping( Connection handle: 1 )

[11:31:48] CMySQLHandler::Ping() - Connection is still alive.

[11:32:12] >> mysql_query( Connection handle: 1 )

[11:32:12] CMySQLHandler::Query(SELECT * FROM `data` WHERE `Name` = '[Sir]MonKat') - Successfully executed.

[11:32:12] >> mysql_store_result( Connection handle: 1 )

[11:32:12] CMySQLHandler::StoreResult() - Result was stored.

[11:32:12] >> mysql_num_rows( Connection handle: 1 )

[11:32:12] CMySQLHandler::NumRows() - Returned 0 row(s)

[11:32:12] >> mysql_num_rows( Connection handle: 1 )

[11:32:12] CMySQLHandler::NumRows() - Returned 0 row(s)

[11:32:12] >> mysql_free_result( Connection handle: 1 )

[11:32:12] CMySQLHandler::FreeResult() - Result was successfully free'd.

GamingTurf
01/01/2012, 02:05 AM
That log shows nothing other than your login feature works.

Try using your register feature and show us the log for the register system.

AK47317
01/01/2012, 02:08 AM
FOR CRYING OUT LOUD. THATS THE LOG! IDK WHICH LOG THAT SHOW REGISTER LOG. IN IN-GAME IT ALWAYS SHOWS UP THE FREAKING REGISTER DOWNLOAD OVER AND OVER AGAIN AS I CONNECT TO THE SERVER. THEN I CHECK IN THE FREAKING MYSQL LOCALHOST THAT HAD DATA ON IT AND CHECK THE INDEX. AND THE INDEX ARE NOT DEFINE AT ALL. DID I MAKE MY SELF CLEAR?

GamingTurf
01/01/2012, 02:11 AM
Yes, correct - that is your mysql log. But it doesn't include anything to do with the register feature??

The mysql_log will show the register log, if any queries are actually called..

What shows up the freaking register download, over and over again? <-- Makes no sense to me at all.

And no, you didn't make yourself clear. How about you stop with your raging when i'm only trying to help you.

AK47317
01/01/2012, 07:54 AM
What shows up the freaking register download, over and over again? <-- Makes no sense to me at all.


i meant is "whats shows up the freaking register dialog over and over again as i join the server.. so mysql doesnt register me at all"

and the log doesnt shows anything about registering to data to me..

AK47317
02/01/2012, 04:38 AM
no one got idea to solve mysterious problem.. well that pretty weird

Johnson_boy
02/01/2012, 07:03 AM
Use rather
if(mysql_num_rows() > 0) //registered
{
}
else //not registered
{
}

and to query
... WHERE `Name` = '%s' LIMIT 1;

if this doesn't help, the problem is in your register query, causing some kind of error.
Your log didn't cover the register query.

AK47317
02/01/2012, 09:14 AM
Use rather
if(mysql_num_rows() > 0) //registered
{
}
else //not registered
{
}

and to query
... WHERE `Name` = '%s' LIMIT 1;

if this doesn't help, the problem is in your register query, causing some kind of error.
Your log didn't cover the register query.

with it or without it is the same still doesnt work.. the thing is weird.. i dont type the password and i press submit button.. it doesnt effect anything. it spose to be out of dialog that said wrong password but it dint out.. so it must be dialog bug..

Dark_Kostas
02/01/2012, 09:51 AM
if ( strlen ( inputtext ) <= 0 || strlen ( inputtext ) > 100 )

AK47317
03/01/2012, 08:00 AM
if ( strlen ( inputtext ) <= 0 || strlen ( inputtext ) > 100 )

the problem is my server is 0.3d RC2 and my client are 0.3d RC1 so it fail.. anyway it fixed