[help] Mysql connecting
#1

Hi Guys,

I know I post alot of posts about mysql, and this is the main reason why.
I'v tried to fix this issue a long time now but no matter what I do it seems that I never get this fixed.

Some times when you connect to the server before you are at the login dialog the server automaticly restarts without errors.

I have checked the log and this is what I get from it.
Код:
[00:00:39] Number of vehicle models: 162
[00:01:23] Incoming connection: **.***.***.**:26983
[00:01:23] [join] Ben_Sherman has joined the server (0:**.***.***.**)
[00:01:33] Ben_Sherman has logged in.
[00:01:38] [part] Ben_Sherman has left the server (0:1)
[00:05:56] Incoming connection: **.***.***.**:3144
[00:05:56] [join] Robinson_Smith has joined the server (0:**.***.***.**)
[00:06:08] [part] Robinson_Smith has left the server (0:1)
[00:06:40] Incoming connection: **.***.***.**:49872
[00:06:40] [join] Jayson_Parker has joined the server (0:**.***.***.**)
[00:06:44] Jayson_Parker has logged in.
[00:07:36] Incoming connection: **.***.***.**:26986
[00:07:36] [join] Ben_Sherman has joined the server (1:**.***.***.**)
-Server Restarts
You see, it's just restarts without warnings, it's like when the player that connects to the serverver makes it lost connection to the database and it automaticly restarts

It's only when the player connects and it just happens some time.
On the samp client you get this.

Samp 0.3d
Connecting to IP.
Connected to IP.
and then nothing and you wait for like 10 seconds and then you get the Restart message and it all happens over agen.

It's hard to explain but something werd happens and the server lost connection to the DB and the server restarts.
I'm not sure that the server lost connection to the DB it's just a guess.

I really need some help.

under onplayerconnect I have this
pawn Код:
public OnPlayerConnect(playerid)
{
    Initloading(playerid);
    return 1;
}
under Initloading(playerid); I have this
pawn Код:
public Initloading(playerid)
{
        new string[500];
    SendClientMessage(playerid, 0xF1B72E99, " ");
    SendClientMessage(playerid, 0xF1B72E99, " ");
    SendClientMessage(playerid, 0xF1B72E99, " ");
    SendClientMessage(playerid, 0xF1B72E99, " ");
    SendClientMessage(playerid, 0xF1B72E99, " ");
    SendClientMessage(playerid, 0xF1B72E99, " ");
    SendClientMessage(playerid, 0xF1B72E99, " ");
    SendClientMessage(playerid, 0xF1B72E99, " ");
    SendClientMessage(playerid, 0xF1B72E99, " ");
    SendClientMessage(playerid, 0xF1B72E99, " ");
    SendClientMessage(playerid, 0xF1B72E99, " ");
    SendClientMessage(playerid, 0xF1B72E99, " ");
    SendClientMessage(playerid, 0xF1B72E99, " ");
    SendClientMessage(playerid, 0xF1B72E99, " ");
    SendClientMessage(playerid, 0xF1B72E99, " ");
    new str[160];
    GetPlayerName(playerid, str, MAX_PLAYER_NAME);
    for (new i = 0; i < MAX_PLAYER_NAME; i++)
    if (str[i] == '_')
        str[i] = ' ';
    format(string, sizeof(string), "Welcome %s,", str);
    SendClientMessage(playerid, 0xF1B72E99, string);
    InitOnConnection(playerid);
    InitPlayerConnection(playerid);
    return 1;
}
Under InitOnConnection(playerid);
pawn Код:
stock InitOnConnection(playerid)
{
        new plname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, plname, sizeof(plname));
    UsedCrack[playerid] = 0;
    Called[playerid] = 0;
    Busline1[playerid][0] = 0;
    Busline2[playerid][0] = 0;
    Busline3[playerid][0] = 0;
    BusShowLocation[playerid][0] = 0;
    BusShowLocationC[playerid] = 0;
    SellCar[playerid] = 0;
    Training[playerid] = 0;
    PlayerStoned[playerid] = 0;
    Taze1[playerid] = 0;
    Taze2[playerid] = 0;
    InAFoodPlace[playerid] = 0;
    InAFoodPlace[playerid] = 0;
    ViewingBox[playerid] = 0;
    UseSunGlasses[playerid] = 0;
        editingcd[playerid] = -1;
    editingcdveh[playerid] = -1;
    CharacterStatus[playerid] = 0;
    editingcdvehnew[playerid] = 0;
    RobStart[playerid] = 0;
    IsCuttingTrees[playerid] = 0;
    GunStore[playerid] = 0;
    RobReady[playerid] = 0;
    Question[playerid] = 0;
    Radio[playerid] = 0;
    editingcdvehpos[playerid] = 0;
    playertryrobbed[playerid] = 0;
    LoadStats(playerid);
    LostHP[playerid] = 0;
    LostHP2[playerid] = 0;
    UsedWeed[playerid] = 0;
    SelectChar[playerid] = 0;
    HidePM[playerid] = 0;
    NoText[playerid] = 0;
    HideBriefcase[playerid] = 0;
    PhoneOnline[playerid] = 0;
    Seatbelt[playerid] = 0;
    SelectCharID[playerid] = 0;
    SelectCharPlace[playerid] = 0;
    ChosenSkin[playerid] = 0;
    GettingJob[playerid] = 0;
    GuardOffer[playerid] = 999;
    GuardPrice[playerid] = 0;
    OwnableCarOffer[playerid] = 999;
    OwnableCarID[playerid] = 0;
        OwnableCarPrice[playerid] = 0;
        CallLawyer[playerid] = 0;
    WantLawyer[playerid] = 0;
    IceCreamOffer[playerid] = 999;
    IceCreamPrice[playerid] = 0;
    KickPlayer[playerid] = 0;
    CurrentMoney[playerid] = 0;
    CP[playerid] = 0;
    Robbed[playerid] = 0;
    SpawnChange[playerid] = 1;
    CarOffer[playerid] = 999;
    CarPrice[playerid] = 0;
    RadioT[playerid] = 0;
    CarID[playerid] = 0;
    CarCalls[playerid] = 0;
    RobbedTime[playerid] = 0;
    MoneyMessage[playerid] = 0;
    Condom[playerid] = 0;
    STIPlayer[playerid] = 0;
    SexOffer[playerid] = 999;
    SexPrice[playerid] = 0;
    RepairOffer[playerid] = 999;
    RepairPrice[playerid] = 0;
    RepairCar[playerid] = 0;
    BlowjobOffer[playerid] = 999;
    BlowjobPrice[playerid] = 0;
    TalkingLive[playerid] = 255;
    LiveOffer[playerid] = 999;
    TakingLesson[playerid] = 0;
    RefillOffer[playerid] = 999;
    RefillPrice[playerid] = 0;
    MapIconsShown[playerid] = 0;
        PotOffer[playerid] = 999;
    PlayerCuffed[playerid] = 0;
    PlayerCuffedTime[playerid] = 0;
    CrackOffer[playerid] = 999;
    PotPrice[playerid] = 0;
    CrackPrice[playerid] = 0;
    RegistrationStep[playerid] = 0;
    TutStep[playerid] = 0;
    Ticket1[playerid] = 0;
    Ticket2[playerid] = 0;
    OnCK[playerid] = 999;
    GettingCK[playerid] = 999;
    PotGram[playerid] = 0;
    CrackGram[playerid] = 0;
    ConnectedToPC[playerid] = 0;
    TogSpeed[playerid] = 0;
    OrderReady[playerid] = 0;
    JailPrice[playerid] = 0;
    MedicBill[playerid] = 0;
    GotHit[playerid] = 0;
    GoChase[playerid] = 999;
    GetChased[playerid] = 999;
    PlacedNews[playerid] = 0;
    OnDuty[playerid] = 0;
    DrivingTest[playerid] = 0;
    DrivingTest2[playerid] = 0;
    BoxWaitTime[playerid] = 0;
    SchoolSpawn[playerid] = 0;
    ChangePos2[playerid][1] = 0;
    SafeTime[playerid] = 60;
    TransportDuty[playerid] = 0;
    PlayerTied[playerid] = 0;
    BusCallTime[playerid] = 0;
    TaxiCallTime[playerid] = 0;
    MedicCallTime[playerid] = 0;
    MechanicCallTime[playerid] = 0;
    FindTimePoints[playerid] = 0;
    FindTime[playerid] = 0;
    DrivingStep[playerid] = 0;
    DrivingCar[playerid] = 0;
    DrivingBike[playerid] = 0;
    DrivingTruck[playerid] = 0;
    JobDuty[playerid] = 0;
    Mobile[playerid] = 255;
    Music[playerid] = 0;
    BoxOffer[playerid] = 999;
    PlayerBoxing[playerid] = 0;
    DrugDeliver[playerid] = 0;
    Spectate[playerid] = 255;
    PlayerDrunk[playerid] = 0;
    PlayerDrunkTime[playerid] = 0;
    PlayerDrunkTimeLeft[playerid] = 0;
    Unspec[playerid][sLocal] = 255;
    MatDeliver[playerid] = 0;
    PlayerPaintballing[playerid] = 0;
    PlayerPaintballKills[playerid] = 0;
    WritingPaper[playerid] = 0;
    WritingPaperNumber[playerid] = 999;
    WritingLine[playerid] = 0;
    BringingPaper[playerid] = 0;
    GotPaper[playerid] = 0;
    PaperOffer[playerid] = 999;
    ConsumingMoney[playerid] = 0;
    MatDeliver2[playerid] = 0;
        gLastCar[playerid] = 0;
    gOoc[playerid] = 0;
    gNews[playerid] = 0;
    BigEar[playerid] = 0;
    BigEarW[playerid] = 0;
    BigEarG[playerid] = 0;
    BigEarsON[playerid] = 0;
    gDice[playerid] = 0;
    gFam[playerid] = 0;
    gSpeedo[playerid] = 0;
    gGas[playerid] = 0;
    pOnHand[playerid] = 0;
    IsMilkingCows[playerid] = 0;
    IsFarmingWeed[playerid] = 0;
    gPlayerLogged[playerid] = 0;
    gPlayerLogTries[playerid] = 0;
    gPlayerAccount[playerid] = 0;
    CowEndTime[playerid] = 0;
    FarmEndTime[playerid] = 0;
    gPlayerSpawned[playerid] = 0;
    IsCollectingRubbish[playerid] = 0;
    GarbageEndTime[playerid] = 0;
    GarbageTime[playerid] = 0;
    BinTime[playerid] = 0;//garbagejob
    PlayerTazeTime[playerid] = 0;
    EnterCarTime[playerid] = 0;
    EnterCarTimeH[playerid] = 0;
    LoadTankerTime[playerid] = 0;
    UnloadTankerTime[playerid] = 0;//ftjob
    StartTime[playerid] = 0;
    TicketOffer[playerid] = 999;
    TicketMoney[playerid] = 0;
    CowTime[playerid] = 0;
    MatsHolding[playerid] = 0;
    TutTime[playerid] = 0;
    LicDTest[playerid] = 0;
    LicDTest2[playerid] = 0;
    LicDTest3[playerid] = 0;
    LicDTest4[playerid] = 0;
    LicDTime[playerid] = 0;
    LicDTime2[playerid] = 0;
    LicDTime3[playerid] = 0;
    LicDTime4[playerid] = 0;
    LicDTime5[playerid] = 0;
    gPlayerMission[playerid] = 0;
    TaxiAccepted[playerid] = 999;
    BusAccepted[playerid] = 999;
    NoFuel[playerid] = 0;
    HireCar[playerid] = 299;
    PlayersChannel[playerid] = 999;
    Onheadset[playerid] = 1;
    TransportValue[playerid] = 0;
    TransportMoney[playerid] = 0;
    TransportTime[playerid] = 0;
    TransportCost[playerid] = 0;
    TransportDriver[playerid] = 999;
    Locator[playerid] = 0;
    PlayerOnMission[playerid] = 0;
    MissionCheckpoint[playerid] = 0;
    WatchingTV[playerid] = 0;
    SoonToBeDeleted[playerid] = 0;
    NewbieTut[playerid] = 0;
    ConnectedToMDC[playerid] = 0;
    AccentOn[playerid] = 0;
    FirstSpawn[playerid] = 1;
    StoreRobed[playerid] = 0;
    Robber[playerid] = 0;
    JustReported[playerid] = 0;
    PlayerNeedsHelp[playerid] = 0;
    CheckMoney[playerid] = 1;
    ImpoundOpen[playerid] = 0;
    IsSweeping[playerid] = 0;
    PlayerSmoking[playerid] = 0;
    PlayerCiggs[playerid] = 0;
    ProposeOffer[playerid] = 999;
    MarryWitness[playerid] = 999;
    MarryWitnessOffer[playerid] = 999;
    MarriageCeremoney[playerid] = 0;
    ProposedTo[playerid] = 999;
    GotProposedBy[playerid] = 999;
    DivorceOffer[playerid] = 999;
    Mask[playerid] = 1;
    HelpMessages[playerid] = 1;
    harvested[playerid] = 0;
    LockX[playerid] = 0;
    LockY[playerid] = 0;
    LockZ[playerid] = 0;
    LockedOnce[playerid] = 0;
    CCTVSpeed[playerid] = 0;
    DMVName[playerid] = 0;
    DMVMessage[playerid] = 0;

    ClearCrime(playerid);
    ClearMarriage(playerid);
    SetPlayerColor(playerid,COLOR_GRAD2);
    new string[256];
    GetPlayerName(playerid, plname, sizeof(plname));
    new loginname[64];
    new playersip[64];
    GetPlayerName(playerid,loginname,sizeof(loginname));
    GetPlayerIp(playerid,playersip,sizeof(playersip));
    format(string, sizeof(string), "%s [ID:%d] Has connected (( %s ))", loginname, playerid, playersip);
    SendAdminMessage(0xDE1BCF96, string);
    return 1;
}
and under InitPlayerConnection(playerid) I have this
pawn Код:
stock InitPlayerConnection(playerid)
{
    new Query[512], DataString[128], EscapedName[MAX_PLAYER_NAME], JaName[MAX_PLAYER_NAME];
        new loginstring[128];
    GetPlayerName(playerid, JaName, sizeof(JaName));
    mysql_real_escape_string(JaName, EscapedName);
    #pragma unused Name
    format(Query, sizeof(Query), "SELECT * FROM `accounts` WHERE `pName` = '%s'", EscapedName);
    mysql_query(Query);
    mysql_store_result();
    if(mysql_num_rows() >= 1)
    {
        if(mysql_num_rows() >= 2)
        {
                    mysql_free_result();
                    SendClientMessage(playerid, -1, "There seems to be duplicates of your account, please contact a high-level admin.");
            Kick(playerid);
        }
        else
        {
                    mysql_fetch_field("UserID", DataString);
                    DatabaseID[playerid] = strval(DataString);

            format(Query, sizeof(Query), "SELECT * FROM `accounts` WHERE `pName` = '%s'", EscapedName);
            mysql_query(Query);
            mysql_store_result();
            mysql_fetch_field("pKey", DataString);
            format(PlayerInfo[playerid][pKey], 128, "%s", DataString);*/
           
            format(loginstring,sizeof(loginstring),"Welcome. \n \nThat name is registered.\nPlease enter your password below:");
            ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"Login.",loginstring,"Login","Exit");
        }
    }
    else
    {
            mysql_free_result();
                SendClientMessage(playerid, -1, "[INFO] Please signup at our UCP to play here");
                SendClientMessage(playerid, -1, " ");
                SendClientMessage(playerid, -1, "We are looking forward to see you soon...");
        Kick(playerid);
    }
}
Sorry for all the content in this post, but I would probably get a message later about posting any of this.
But here it all are under onplayerconnect and some where the error are probably under here.

Need help, please help I'm looking forward for all suggestions for me and all help I can get.

-Best Regards
Tony
Reply
#2

Currently having the same issue as your, still haven't found anything.
Reply
#3

Quote:
Originally Posted by xMichaelx
Посмотреть сообщение
Currently having the same issue as your, still haven't found anything.
Then it makes us two of us. I have searched for a issue like this all over sa:mp haven't find anything like this.
What plugin do you use?

I use Ethan's mysql plugin...
Reply
#4

I use BlueG's plugin and .inc, what OS are you using as i don't find the problem so much on Windows.
Reply
#5

Quote:
Originally Posted by xMichaelx
Посмотреть сообщение
I use BlueG's plugin and .inc, what OS are you using as i don't find the problem so much on Windows.
I use Linux on my host, and windows 7 ultimate on my test server.
It's the same on windows and linux :S
Reply
#6

Update from a crash detecter.
Anyone knows this error?

Код:
[17:05:37] --- crashdetect 3.6.11.0 loaded
[17:19:30] Server crash caused by native mysql_fetch_field() called at address 0x317458 in 'gamemodes/DICE.amx'
[17:19:30] Call stack (most recent call first):
[17:19:30]   0x003171a4()
[17:19:30]   public Initloading()
[17:19:30]   0x????????()
[17:19:34] 
[17:19:34] --- crashdetect 3.6.11.0 loaded
Reply
#7

You need to use mysql_retrieve_row() to update the internal pointer to get information from the current row, then you can use mysql_fetch_field().
Reply
#8

Quote:
Originally Posted by Calgon
Посмотреть сообщение
You need to use mysql_retrieve_row() to update the internal pointer to get information from the current row, then you can use mysql_fetch_field().
Sorry mate, but I dont have those natives in my mysql plugin...
pawn Код:
native MySQL:mysql_connect(const host[], const user[], const pass[], const db[], auto_reconnect = 0);
native mysql_log(logtype, windowerrors = (1), MySQL:handle = (MySQL:0));
native mysql_close(MySQL:handle = (MySQL:0));
native mysql_reload(MySQL:handle = (MySQL:0));
native mysql_select_db(const db[], MySQL:handle = (MySQL:0));
native mysql_query(const query[], resultid = (-1), spareid = (0), MySQL:handle = (MySQL:0));
native mysql_query_array(const query[], resultid = (-1), {Float,_}:extravars[], MySQL:handle = (MySQL:0));
native mysql_store_result(MySQL:handle = (MySQL:0));
native mysql_free_result(MySQL:handle = (MySQL:0));
native mysql_result_stored(MySQL:handle = (MySQL:0));
native mysql_fetch_field(const fieldname[], dest[], MySQL:handle = (MySQL:0));
native mysql_fetch_field_num(fieldnum, dest[], MySQL:handle = (MySQL:0));
native mysql_fetch_row(dest[], const splitter[] = "|", MySQL:handle = (MySQL:0));
native mysql_fetch_row_data(MySQL:handle = (MySQL:0));
native mysql_real_escape_string(const string[], dest[], MySQL:handle = (MySQL:0));
native mysql_num_rows(MySQL:handle = (MySQL:0));
native mysql_num_fields(MySQL:handle = (MySQL:0));
native mysql_affected_rows(MySQL:handle = (MySQL:0));
native mysql_insert_id(MySQL:handle = (MySQL:0));
native mysql_ping(MySQL:handle = (MySQL:0));
native mysql_error(dest[], MySQL:handle = (MySQL:0));
native mysql_errno(MySQL:handle = (MySQL:0));
native mysql_warning_count(MySQL:handle = (MySQL:0));
native mysql_info(dest[], MySQL:handle = (MySQL:0));
native mysql_stat(dest[], MySQL:handle = (MySQL:0));
native mysql_get_server_info(dest[], MySQL:handle = (MySQL:0));
native mysql_get_host_info(dest[], MySQL:handle = (MySQL:0));
native mysql_data_seek(rownum, MySQL:handle = (MySQL:0));
native mysql_set_character_set(const csname[], MySQL:handle = (MySQL:0));
native mysql_fetch_int(MySQL:handle = (MySQL:0));
native Float:mysql_fetch_float(MySQL:handle = (MySQL:0));
native mysql_fetch_string(dest[], MySQL:handle = (MySQL:0));
Reply
#9

use mysql_debug(1); on OnGameModeInit and show us the mysql log
Reply
#10

Quote:
Originally Posted by T0pAz
Посмотреть сообщение
use mysql_debug(1); on OnGameModeInit and show us the mysql log
Well I dont have mysql_debug, but I have mysql_log(LOG_ALL); on

You can find the logfile here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)