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
#2

BUMP!!!!
Reply
#3

Have you linked the database to your mysqlhost?
Reply
#4

no is mysql is sqlite, i open db in OnGameModeint
Reply
#5

Have you tried using crashdetect to get a better look at what's crashing the server?
Reply
#6

no, i download now and test,I did not remember this plugin thanks
Reply
#7

pawn Код:
[20:47:19] [debug] Server crashed while executing CNR.amx
[20:47:19] [debug] AMX backtrace:
[20:47:19] [debug] #0 native db_get_field_assoc () from samp-server.exe
[20:47:19] [debug] #1 0000bf5c in public OnDialogResponse (0, 1, 1, -1, 367852) from CNR.amx
[20:47:19] [debug] Native backtrace:
[20:47:19] [debug] #0 0046ed61 in ?? () from samp-server.exe
[20:47:19] [debug] #1 004010b6 in ?? () from samp-server.exe
[20:47:19] [debug] #2 5f9b01b4 in ?? () from plugins\crashdetect.DLL
[20:47:19] [debug] #3 5f9b62ca in ?? () from plugins\crashdetect.DLL
[20:47:19] [debug] #4 5f9b8b28 in ?? () from plugins\crashdetect.DLL
[20:47:19] [debug] #5 5f9b09c7 in ?? () from plugins\crashdetect.DLL
[20:47:19] [debug] #6 5f9b631a in ?? () from plugins\crashdetect.DLL
[20:47:19] [debug] #7 5e314885 in ?? () from plugins\streamer.DLL
[20:47:19] [debug] #8 0046e161 in ?? () from samp-server.exe
[20:47:19] [debug] #9 004529e0 in ?? () from samp-server.exe
[20:47:19] [debug] #10 0049a6f9 in ?? () from samp-server.exe
[20:47:19] [debug] #11 004a5b1e in ?? () from samp-server.exe
SOLVED I ADD #include <sqlitei>
Reply
#8

Add all of these codes in your script:
Код:
public OnVehicleSpawn(vehicleid)
{
return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}

public OnPlayerText(playerid, text[])
{
return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}


public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}


public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}

public OnRconCommand(cmd[])
{
return 1;
}

public OnObjectMoved(objectid)
{
return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}

public OnPlayerExitedMenu(playerid)
{
return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}

public OnPlayerUpdate(playerid)
{
return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}

public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
return 1;
}

public OnPlayerClickTextDraw(playerid, Text:clickedid)
{

return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)