[HELP] MySQL crash myserver..
#1

hey guys,
i made a modification on my cookie system ( a new one ) but then i start the server and i join the server.. it make the server closed down automaticly.. hope u guys can help. This is the code:

define:
pawn Код:
#define SQL_HOST            "localhost"
#define SQL_USER            "root"
#define SQL_PASS            ""
#define SQL_DATA            "cookie"
onplayerconnect callbacks:
pawn Код:
public OnPlayerConnect ( playerid ) {
    new
        iName [ MAX_NAMES ] ,
        Query [ MAX_STRINGS ] ,
        str [ MAX_MENU_STRINGS ] ;
       
    GetPlayerName ( playerid , iName , sizeof ( iName ) ) ;
    mysql_real_escape_string ( iName , iName ) ;
   
    format ( Query , sizeof ( Query ) , "SELECT * FROM `users` WHERE `username` = '%s' LIMIT 1" , iName ) ;
    mysql_query ( Query ) ;
    mysql_store_result ( ) ;
   
    if ( mysql_num_rows ( ) == 0 ) {
        strcat ( str , ""YELLOW"This server is using "RED"MySQL Cookie System "YELLOW"that made by "RED"Mubarrak48.\n" ) ;
        strcat ( str , ""RED"MySQL Cookie System "YELLOW"are in "RED"first version of 1.0. "YELLOW"If you want to know more updates,\n" ) ;
        strcat ( str , ""YELLOW"Stay active in the server. More feature will come.\n\n" ) ;
        strcat ( str , ""YELLOW"Click "RED"YES "YELLOW"if you want to register in our "RED"databasen\n" ) ;
        strcat ( str , ""YELLOW"Clcik "RED"NO "YELLOW"if you want to continue without register in our "RED"database" ) ;
       
        ShowPlayerDialog ( playerid , DIALOG_COOKIE_REG , DIALOG_STYLE_MSGBOX , DIALOG_TITLE , str , "YES" , "NO" ) ;
    }
    else {
        strcat ( str , ""YELLOW"Welcome back "RED"%s, "YELLOW"You may continue when pressing "RED"Submit "YELLOW"button" ) ;
       
        ShowPlayerDialog ( playerid , DIALOG_COOKIE_INFO , DIALOG_STYLE_MSGBOX , DIALOG_TITLE , str , "Submit" , "" ) ;
    }
    mysql_free_result ( ) ;
    return 1 ;
}
[

and OnDialogResponse callbacks:
pawn Код:
public OnDialogResponse ( playerid , dialogid , response , listitem , inputtext [ ] ) {
    new
        iName [ MAX_NAMES ] ,
        Query [ MAX_STRINGS ] ,
        str [ MAX_MENU_STRINGS ] ;
       
    GetPlayerName ( playerid , iName , sizeof ( iName ) ) ;
    mysql_real_escape_string ( iName , iName ) ;
       
    if ( dialogid == DIALOG_COOKIE_REG ) {
        if ( !response )
            return 0 ;
           
        if ( response ) {
            format ( Query , sizeof ( Query ) , "INSERT INTO `users` ( `username` , `cookie` ) VALUE ( '%s' , 0 )" , iName ) ;
            mysql_query ( Query ) ;
            mysql_store_result ( ) ;

            strcat ( str , ""YELLOW"You have successfully "RED"register in our database.\n" ) ;
            strcat ( str , ""YELLOW"Have fun playing with "RED"MySQL Cookie System "YELLOW"Version 1.0" ) ;

            ShowPlayerDialog ( playerid , DIALOG_COOKIE_DONE_REG , DIALOG_STYLE_MSGBOX , DIALOG_TITLE , str , "Submit" , "" ) ;
        }
    }
    return 1 ;
}
Reply
#2

If the server is closing down once you start samp-server.exe, the problem will occur in your OnGameModeInit callback. Post that part of your script, and we may be able to help you fix your problem.
Reply
#3

MySQL Cookie Pastebin
Reply
#4

Does everything compile correctly you for you? I'm unsure about the way those includes are included into the mode. Do you also have all of those includes in their correct positions?

There could be something else closing down the server, like in incorrect setup in your server.cfg file. Please post the contents of that file (removing the "rcon_password" line). Also make sure you are installing the plugins or any other scripts used in your server correctly.
Reply
#5

He's talking about when someone joins the 'server', it automatically crashes.
Anyways, I have this problem to..
I've found a few ways that have kinda solved the problem. (I still have the problem)
My answer is not really going to help you, so, someone help me also :P.
Reply
#6

Quote:
Originally Posted by Bakr
Посмотреть сообщение
Does everything compile correctly you for you? I'm unsure about the way those includes are included into the mode. Do you also have all of those includes in their correct positions?

There could be something else closing down the server, like in incorrect setup in your server.cfg file. Please post the contents of that file (removing the "rcon_password" line). Also make sure you are installing the plugins or any other scripts used in your server correctly.
what the heck?!?! i already compile it without any error on it.. so no.. i wont post my server configuration..
Reply
#7

Remove the free_result function and see if that works, I've had issues with it before.
Reply
#8

Don't you need it though to keep things in sync?
The function is needed after using mysql_store_result().
Reply
#9

Quote:
Originally Posted by dr.pepper
Посмотреть сообщение
Don't you need it though to keep things in sync?
The function is needed after using mysql_store_result().
I misread the script.

@OP: quit being lazy and just debug it, place "print" functions all over it so you know exactly when it crashes
Reply
#10

omg whats the solution then?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)