SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 31/12/2011, 03:37 AM   #1
AK47317
Huge Clucker
 
AK47317's Avatar
 
Join Date: Jan 2010
Location: Pahang, Malaysia
Posts: 245
Reputation: 8
Unhappy [HELP] MySQL Registration Failure

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.

pawn Code:
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 ;
}

pawn Code:
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.
AK47317 is offline   Reply With Quote
Old 31/12/2011, 04:35 AM   #2
[HiC]TheKiller
High-roller
 
Join Date: Mar 2008
Location: New Zealand
Posts: 2,630
Reputation: 410
Default Re: [HELP] MySQL Registration Failure

pawn Code:
mysql_debug(1);
under OnGameModeInit and then post your mysql_log file that is in your server directory.
__________________
[HiC]TheKiller is offline   Reply With Quote
Old 01/01/2012, 02:04 AM   #3
AK47317
Huge Clucker
 
AK47317's Avatar
 
Join Date: Jan 2010
Location: Pahang, Malaysia
Posts: 245
Reputation: 8
Default Re: [HELP] MySQL Registration Failure

Really? ive used that already

Code:
[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.
AK47317 is offline   Reply With Quote
Old 01/01/2012, 03:05 AM   #4
GamingTurf
Big Clucker
 
Join Date: Mar 2011
Posts: 177
Reputation: 29
Default Re: [HELP] MySQL Registration Failure

That log shows nothing other than your login feature works.

Try using your register feature and show us the log for the register system.
GamingTurf is offline   Reply With Quote
Old 01/01/2012, 03:08 AM   #5
AK47317
Huge Clucker
 
AK47317's Avatar
 
Join Date: Jan 2010
Location: Pahang, Malaysia
Posts: 245
Reputation: 8
Default Re: [HELP] MySQL Registration Failure

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?
AK47317 is offline   Reply With Quote
Old 01/01/2012, 03:11 AM   #6
GamingTurf
Big Clucker
 
Join Date: Mar 2011
Posts: 177
Reputation: 29
Default Re: [HELP] MySQL Registration Failure

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.
GamingTurf is offline   Reply With Quote
Old 01/01/2012, 08:54 AM   #7
AK47317
Huge Clucker
 
AK47317's Avatar
 
Join Date: Jan 2010
Location: Pahang, Malaysia
Posts: 245
Reputation: 8
Default Re: [HELP] MySQL Registration Failure

Quote:
Originally Posted by GamingTurf View Post
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 is offline   Reply With Quote
Old 02/01/2012, 05:38 AM   #8
AK47317
Huge Clucker
 
AK47317's Avatar
 
Join Date: Jan 2010
Location: Pahang, Malaysia
Posts: 245
Reputation: 8
Default Re: [HELP] MySQL Registration Failure

no one got idea to solve mysterious problem.. well that pretty weird
AK47317 is offline   Reply With Quote
Old 02/01/2012, 08:03 AM   #9
Johnson_boy
Huge Clucker
 
Join Date: Mar 2011
Location: Finland
Posts: 215
Reputation: 80
Default Re: [HELP] MySQL Registration Failure

Use rather
Code:
if(mysql_num_rows() > 0) //registered
{
}
else //not registered
{
}
and to query
Code:
... 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.
Johnson_boy is offline   Reply With Quote
Old 02/01/2012, 10:14 AM   #10
AK47317
Huge Clucker
 
AK47317's Avatar
 
Join Date: Jan 2010
Location: Pahang, Malaysia
Posts: 245
Reputation: 8
Default Re: [HELP] MySQL Registration Failure

Quote:
Originally Posted by Johnson_boy View Post
Use rather
Code:
if(mysql_num_rows() > 0) //registered
{
}
else //not registered
{
}
and to query
Code:
... 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..
AK47317 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Mysql registration Tonyss23 Scripting Help 1 26/08/2011 03:06 PM
Mysql Registration help futuretrucker Help Archive 6 23/05/2011 04:35 AM
[HELP] MySQL registration failed AK47317 Help Archive 2 09/05/2011 11:52 AM
MySQL Connecting failure Sascha Help Archive 4 23/02/2011 10:41 AM
MySQL Connect failure hanzen Help Archive 4 05/12/2010 04:00 PM


All times are GMT. The time now is 07:30 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.