Server crash after login
#1

hi friend, the server closes after put password, Help :/

pawn Код:
new DB:Database;
//-----------------------------------------

#define CnRDB_NAME                  "sampcnr.db"        // Server database name

And in GameModeInit

Database = db_open(CnRDB_NAME); // Load Database
pawn Код:
new
        Query[ 256 ], // Creating a big array this time. No lies :X
        DBResult: Result, // Create a database Result
        plrIP[ 16 ], // Create a IP string
        buf[129]
    ;
    GetPlayerIp(playerid, plrIP, sizeof(plrIP));

pawn Код:
if(dialogid == dlogin)
    {
        if(response)
        {
            new wstring[256];
            WP_Hash(buf, 129, inputtext);
            format(Query, sizeof(Query), "SELECT * FROM `users` WHERE `Username` = '%s' COLLATE NOCASE AND `Password` = '%s'", DB_Escape(GetPlayerName(playerid)), DB_Escape(buf));
            Result = db_query(Database, Query);
            if(db_num_rows(Result))
            {
                new Field[20];

                    db_get_field_assoc(Result, "Admin", Field, 30);
                    pInfo[playerid][Adminlevel] = strval(Query);

                    db_get_field_assoc(Result, "Vip", Field, 30); //this
                    pInfo[playerid][VIPlevel] = strval(Query);

                    db_get_field_assoc(Result, "VipDate", Field, 30); //this
                    pInfo[playerid][VipDate] = strval(Query);

                    db_get_field_assoc(Result, "Money", Field, 30); //this
                    pInfo[playerid][Money] = strval(Query);

                    db_get_field_assoc(Result, "BankM", Field, 30); //this
                    pInfo[playerid][BankM] = strval(Query);

                    db_get_field_assoc(Result, "Score", Field, 30); //this
                    pInfo[playerid][Score] = strval(Query);

                    db_get_field_assoc(Result, "EXP", Field, 30); //this
                    pInfo[playerid][EXP] = strval(Query);

                    db_get_field_assoc(Result, "Kills", Field, 30); //this
                    pInfo[playerid][Kills] = strval(Query);

                    db_get_field_assoc(Result, "Deaths", Field, 30); //this
                    pInfo[playerid][Deaths] = strval(Query);

                    db_get_field_assoc(Result, "Wanted", Field, 30); //this
                    pInfo[playerid][Wanted] = strval(Query);

                    db_get_field_assoc(Result, "JailTime", Field, 30); //this
                    pInfo[playerid][JailTime] = strval(Query);

                    db_get_field_assoc(Result, "Job", Field, 30); //this
                    pInfo[playerid][Job] = strval(Query);

                    db_get_field_assoc(Result, "Fstyle", Field, 30); //this
                    pInfo[playerid][FStyle] = strval(Query);

                    db_get_field_assoc(Result, "PlaceHit", Field, 30); //this
                    pInfo[playerid][Placehit] = strval(Query);

                    db_get_field_assoc(Result, "C4", Field, 30); //this
                    pInfo[playerid][C4] = strval(Query);

                    db_get_field_assoc(Result, "Tie", Field, 30); //this
                    pInfo[playerid][Tie] = strval(Query);

                    db_get_field_assoc(Result, "BC", Field, 30); //this
                    pInfo[playerid][BreakC] = strval(Query);

                    db_get_field_assoc(Result, "BP", Field, 30); //this
                    pInfo[playerid][BreakP] = strval(Query);

                    db_get_field_assoc(Result, "Cutie", Field, 30); //this
                    pInfo[playerid][Cutie] = strval(Query);

                    db_get_field_assoc(Result, "banCops", Field, 30); //this
                    pInfo[playerid][banCops] = strval(Query);

                    db_get_field_assoc(Result, "banArmy", Field, 30); //this
                    pInfo[playerid][banArmy] = strval(Query);

                    db_get_field_assoc(Result, "Dia", Field, 30); //this
                    pInfo[playerid][Dia] = strval(Query);

                    db_get_field_assoc(Result, "Mes", Field, 30); //this
                    pInfo[playerid][Mes] = strval(Query);

                    db_get_field_assoc(Result, "Ano", Field, 30); //this
                    pInfo[playerid][Ano] = strval(Query);

                    pInfo[playerid][Uip] = strval(plrIP);

                    pInfo[playerid][USER_LOGGED_IN] = true;

                    GivePlayerMonez(playerid, pInfo[playerid][Money]);
                    SetPlayerScore(playerid, pInfo[playerid][Score]);
                    SetPlayerWantedLevel(playerid, pInfo[playerid][Wanted]);
                    SetPlayerFightingStyle(playerid, pInfo[playerid][FStyle]);

                    SendClientMessage(playerid, COLOR_SERVER,"[SERVER]"COL_WHITE" Welcome back! You have "COL_GREEN"successfully "COL_WHITE"logged in");//Tell them that they've successfully logged in
                    format(wstring, sizeof(wstring), "~n~~n~~n~~n~~n~~n~~w~Welcome ~p~~p~%s", GetPlayerName(playerid));
                    GameTextForPlayer(playerid, wstring,3000,3);
            }
            else
            {
                new String1[256];
                format(String1,sizeof(String1), ""COL_BLUE"Are you %s? \n"COL_RED"Wrong password, "COL_WHITE"try again!", GetPlayerName(playerid));
                ShowPlayerDialog(playerid, dlogin, DIALOG_STYLE_PASSWORD,""COL_BLUE"Login Panel", String1,"Login","Quit");//We will tell to them that they've entered an incorrect password
            }
            db_free_result(Result);
        }
        else return Kick(playerid); // Kick the player if he selected 'Leave'
    }
Reply


Messages In This Thread
Server close after login - by Cerealguy - 26.12.2014, 19:40
Respuesta: Server crash after login - by Cerealguy - 26.12.2014, 23:49
Re: Server crash after login - by RayC - 27.12.2014, 00:16
Respuesta: Server crash after login - by Cerealguy - 27.12.2014, 00:18
Re: Server crash after login - by RayC - 27.12.2014, 00:21
Respuesta: Server crash after login - by Cerealguy - 27.12.2014, 00:24
Respuesta: Server crash after login - by Cerealguy - 27.12.2014, 00:33
Re: Server crash after login - by RayC - 27.12.2014, 00:35

Forum Jump:


Users browsing this thread: 1 Guest(s)