MySQL database stops working
#1

So I have a really weird bug.. login dialog doesen't appear when there are about 10 players in the server. I would really love some help because I cant figure it out and I cant get my playerbase up.

This is the last thing in my Mysql log:
Код:
15:13:29] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1"
[15:13:29] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM `accounts` WHERE `Name` = 'John_Eazzy' LIMIT 1", callback: "OnAccountCheck", format: "i"
[15:13:29] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called
[15:13:29] [DEBUG] mysql_tquery - scheduling query "SELECT * FROM `accounts` WHERE `Name` = 'John_Eazzy' LIMIT 1"..
[15:13:29] [DEBUG] CMySQLQuery::Execute[OnAccountCheck(i)] - starting query execution
[15:13:29] [DEBUG] CMySQLQuery::Execute[OnAccountCheck(i)] - query was successful
[15:13:29] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[15:13:29] [DEBUG] CMySQLQuery::Execute[OnAccountCheck(i)] - data being passed to ProcessCallbacks()
[15:13:29] [DEBUG] Calling callback "OnAccountCheck"..
[15:13:29] [DEBUG] cache_get_data - connection: 1
[15:13:29] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[15:13:29] [DEBUG] CMySQLQuery::~CMySQLQuery() - deconstructor called
[15:13:32] [DEBUG] mysql_format - connection: 1, len: 512, format: "INSERT INTO `accounts` (`Name`, `Password`, `Admin`, `VIP`, `Warnings`, `Score`, `Money`, `IP`, `Kills`, `Deaths`, `Points`) VAL..."
[15:13:32] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO `accounts` (`Name`, `Password`, `Admin`, `VIP`, `War", callback: "OnAccountRegister", format: "i"
[15:13:32] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called
[15:13:32] [DEBUG] mysql_tquery - scheduling query "INSERT INTO `accounts` (`Name`, `Password`, `Admin`, `VIP`, `Warnings`, `Score`, `Money`, `IP`, `Kills`, `Deaths`, `Points`) VALUES ('John_Eazzy', 'C5F5ADF620B4B6FA3B8C6F7920896A1B7EB9DF35D9968124726E3BD38B92FE0160090202DB55A7C00A1796D3473B66A563C3D2C4435E10C3FD670FE62D7727F6', 0, 0, 0, 0, 0, '178.65.105.238', 0, 0, 0)"..
[15:13:32] [DEBUG] CMySQLQuery::Execute[OnAccountRegister(i)] - starting query execution
[15:13:32] [DEBUG] CMySQLQuery::Execute[OnAccountRegister(i)] - query was successful
[15:13:32] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[15:13:32] [DEBUG] CMySQLQuery::Execute[OnAccountRegister(i)] - data being passed to ProcessCallbacks()
[15:13:32] [DEBUG] Calling callback "OnAccountRegister"..
[15:13:32] [DEBUG] cache_insert_id - connection: 1
[15:13:32] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[15:13:32] [DEBUG] CMySQLQuery::~CMySQLQuery() - deconstructor called
So this is my login/register system:

OnPlayerConnect:
Код:
ShowWelcomeTextdraw(playerid);
SetTimerEx("PreOnAccountCheck", 5000, false, "i", playerid);
	TogglePlayerSpectating(playerid, 1);
The checking:

Код:
forward PreOnAccountCheck(playerid);
public PreOnAccountCheck(playerid)
{
	new query[128];
	HideWelcomeTextdraw(playerid);
    mysql_format(mysql, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1", Name(playerid));
    mysql_tquery(mysql, query, "OnAccountCheck", "i", playerid);
	return 1;
}

forward OnAccountCheck(playerid);
public OnAccountCheck(playerid)
{

	print("Checking the account..");

    new
        rows,
        fields;
    cache_get_data(rows, fields, mysql);

    if(rows)
    {
        cache_get_field_content(0, "Password", PlayerInfo[playerid][pPassword], mysql, 129);
        PlayerInfo[playerid][pID] = cache_get_field_content_int(0, "ID");

        ShowLoginDialog(playerid);
        print("Account exists!\n");
    }
    else
    {
        ShowRegisterDialog(playerid);
		print("Account doesen't exist!\n");
    }
    return true;
}
I really cant get this figured out.. just when there are like 7-8-9-10 players online it starts to bug out, people dont get the dialog, start to spawn in random places.. they just join and get automatically spawned.

Huge, huge thanks to anyone who can help me out here.. it's really annoying for me and my players.
Reply
#2

There is a MySQL connection because when I tried to reconnect, there already was a connection:

Код:
[15:18:26] [DEBUG] mysql_connect - host: "127.0.0.1", user: "mydatabase", database: "mydatabase", password: "****", port: 3306, autoreconnect: true
[15:18:26] [WARNING] CMySQLHandle::Create - connection already exists
[15:18:26] [DEBUG] CMySQLConnection::Connect - connection was successful
[15:18:26] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[15:18:26] [DEBUG] CMySQLConnection::Connect - connection was successful
[15:18:26] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
So the mistake must be somewhere in the login/register?
Reply
#3

Help! Any tips!
Reply
#4

Help, what might be the cause?
Reply
#5

I see you already have a debug, What does it print on the console when this happens ?
Reply
#6

I added this debug code:

pawn Код:
print("OnPlayerConnect block start.");
    ShowWelcomeTextdraw(playerid);
    SetTimerEx("PreOnAccountCheck", 5000, false, "i", playerid);
    TogglePlayerSpectating(playerid, 1);
    print("OnPlayerConnect block end.");
[pawn][07:17:05] [connection] 92.38.40.50:53263 requests connection cookie.
[07:17:06] [connection] incoming connection: 92.38.40.50:53263 id: 10
[07:17:07] [join] kolh has joined the server (10:92.38.40.50)[/code]

Like you see that code didn't get executed, the debug messages didn't print. So it didn't even check his account. It means there is an error somewhere before these lines?

This is the code before that, error somewhere here?

pawn Код:
SetPlayerColor(playerid, C_GREY);
    SendClientMessage(playerid, C_WHITE, "");
    SendClientMessage(playerid, C_WHITE, "");
    SendClientMessage(playerid, C_WHITE, "");
    SendClientMessage(playerid, C_WHITE, "");
    SendClientMessage(playerid, C_WHITE, "");
    SendClientMessage(playerid, C_WHITE, "");
    SendClientMessage(playerid, C_WHITE, "");
    SendClientMessage(playerid, C_WHITE, "");
    SendClientMessage(playerid, C_WHITE, "");
    HideGlobalTextdraws(playerid);

    ZoneBar[playerid] = CreatePlayerProgressBar(playerid, 48.000000, 288.000000, 83.000000, 4.699999, -1429936641, 100.0000, 0);
    SetPlayerProgressBarColour(playerid, ZoneBar[playerid], 0x820302FF);
    HidePlayerProgressBar(playerid, ZoneBar[playerid]);

    new string[128], NewsBoxTemp[64];
    format(string, sizeof(string), "%s has joined %s.", Name(playerid), SERVERNAME);
    SendClientMessageToAll(C_WHITE, string);
    SetBaseIconsToPlayer(playerid);
   
    format(NewsBoxTemp, sizeof NewsBoxTemp, "%s(%d) has ~g~joined ~w~the server.", Name(playerid), playerid);
    UpdateNewsBox(NewsBoxTemp);
   
    //====================================================

    gTeam[playerid] = NO_TEAM;

    PlayerInfo[playerid][pRegistered] = 0;
    PlayerInfo[playerid][pAdmin] = 0;
    PlayerInfo[playerid][pLogged] = 0;
    PlayerInfo[playerid][pAdmin] = 0;
    PlayerInfo[playerid][pWarnings] = 0;
    PlayerInfo[playerid][pKills] = 0;
    PlayerInfo[playerid][pDeaths] = 0;
    PlayerInfo[playerid][pPoints] = 0;
    PlayerInfo[playerid][pBounty] = 0;
    PlayerInfo[playerid][pMoney] = 0;
    PlayerInfo[playerid][pVIP] = 0;
    PlayerInfo[playerid][pVIPTime] = 0;
    PlayerInfo[playerid][pPlayingTime] = 0;
    PlayerInfo[playerid][pMuted] = 0;
    PlayerInfo[playerid][pCash] = 0;
    PlayerInfo[playerid][pHeadshots] = 0;
    PlayerInfo[playerid][pZonesCaptured] = 0;
    PlayerInfo[playerid][pDuelsWon] = 0;
    PlayerInfo[playerid][pDuelsLost] = 0;
    PlayerInfo[playerid][pTopKillingspree] = 0;
    PlayerInfo[playerid][pArenaID] = -1;
    SetPVarInt(playerid, "AdminLevel", 0);

    gKillingSpree[playerid] = 0;
    aDuty[playerid] = 0;
    AFK[playerid] = 0;
    JustJoined[playerid] = 1;
    RoundStats[playerid] = 1;
    IsPlayerChoosingClass[playerid] = 1;
    ClassChoosingStep[playerid] = 0;
    ClassPositionSet[playerid] = 0;
    HackTest[playerid] = 0;
    AirDrop[playerid] = 0;
    gWearingHelmet[playerid] = 0;
    WearingArmor[playerid] = 0;
    MedKits[playerid]= 0;
    GasMask[playerid] = 0;
    gMedKitHealable[playerid] = 1;
    g_EngineerCanFix[playerid] = 1;
    gTeamChoosingStep[playerid] = -1;


    CanCaptureZone[playerid] = 1;
    TogglePM[playerid] = 1;
    CanHeal[playerid] = 1;
    CanSupport[playerid] = 1;
    donatorFix[playerid] = 1;
    gCurrentSessionTime[playerid] = gettime();

    gDuel[playerid][d_induel] = false;
    gDuel[playerid][d_opponent] = INVALID_PLAYER_ID;
    gDuel[playerid][d_weapon] = 0;
    gDuel[playerid][d_bet] = 0;

    for(new i; i < sizeof(gCaptureZone); i++)
    {
        GangZoneShowForPlayer(playerid, gCaptureZone[i][E_ZONEID], gTeamInfo[gCaptureZone[i][E_ZONEOWNER]][E_GANGCOLOR]);
    }

   

    for(new i; i < sizeof(gTeamBase); i++) // Creates the team bases
    {  
        GangZoneShowForPlayer(playerid, gTeamBase[i][B_ZONE], gTeamInfo[gTeamBase[i][B_OWNER]][E_GANGCOLOR]);
    }

   

    //====================================================

    print("OnPlayerConnect block start.");
    ShowWelcomeTextdraw(playerid);
    SetTimerEx("PreOnAccountCheck", 5000, false, "i", playerid);
    TogglePlayerSpectating(playerid, 1);
    print("OnPlayerConnect block end.");
Reply
#7

Download crashdetect plugin and look for any errors on console.
Reply
#8

Is #undef MAX_PLAYERS and #define MAX_PLAYERS (AMOUNT) included in your script?
Reply
#9

Код:
#undef MAX_PLAYERS
#define MAX_PLAYERS         100
My server is 100 slot. I will see when I get 8 players again, and what crashdetect shows me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)