SA-MP Forums Archive
MySQL problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: MySQL problem (/showthread.php?tid=206726)



MySQL problem - exDDDD - 04.01.2011

pawn Код:
public OnPlayerLogin(playerid,password[])
{
    new tmp2[256];
    new string2[64];
    new playername2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    MySQLFetchAcctSingle(playerid, "Password", PlayerInfo[playerid][pKey]);
    if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
    {
        new Data[1024];
        new Field[64];
        new rcnt = 1;
        MySQLFetchAcctRecord(playerid, Data);
        samp_mysql_strtok(Field, "|", Data);
        while (samp_mysql_strtok(Field, "|", "")==1)
        {
            if (rcnt == 3) PlayerInfo[playerid][pLevel] = strval(Field);
            if (rcnt == 4) PlayerInfo[playerid][pAdmin] = strval(Field);
            if (rcnt == 5) PlayerInfo[playerid][pDonateRank] = strval(Field);
            if (rcnt == 6) PlayerInfo[playerid][gPupgrade] = strval(Field);
            if (rcnt == 7) PlayerInfo[playerid][pConnectTime] = strval(Field);
            if (rcnt == 8) PlayerInfo[playerid][pReg] = strval(Field);
            if (rcnt == 9) PlayerInfo[playerid][pSex] = strval(Field);
            if (rcnt == 10) PlayerInfo[playerid][pAge] = strval(Field);
            if (rcnt == 11) PlayerInfo[playerid][pOrigin] = strval(Field);
            if (rcnt == 12) PlayerInfo[playerid][pCK] = strval(Field);
            if (rcnt == 13) PlayerInfo[playerid][pMuted] = strval(Field);
            if (rcnt == 14) PlayerInfo[playerid][pExp] = strval(Field);
            if (rcnt == 15) PlayerInfo[playerid][pCash] = strval(Field);
            if (rcnt == 16) PlayerInfo[playerid][pAccount] = strval(Field);
            if (rcnt == 17) PlayerInfo[playerid][pCrimes] = strval(Field);
            if (rcnt == 18) PlayerInfo[playerid][pKills] = strval(Field);
            if (rcnt == 19) PlayerInfo[playerid][pDeaths] = strval(Field);
            if (rcnt == 20) PlayerInfo[playerid][pArrested] = strval(Field);
            if (rcnt == 21) PlayerInfo[playerid][pWantedDeaths] = strval(Field);
            if (rcnt == 22) PlayerInfo[playerid][pPhoneBook] = strval(Field);
            if (rcnt == 23) PlayerInfo[playerid][pLottoNr] = strval(Field);
            if (rcnt == 24) PlayerInfo[playerid][pFishes] = strval(Field);
            if (rcnt == 25) PlayerInfo[playerid][pBiggestFish] = strval(Field);
            if (rcnt == 26) PlayerInfo[playerid][pJob] = strval(Field);
            if (rcnt == 27) PlayerInfo[playerid][pPayCheck] = strval(Field);
            if (rcnt == 28) PlayerInfo[playerid][pHeadValue] = strval(Field);
            if (rcnt == 29) PlayerInfo[playerid][pJailed] = strval(Field);
            if (rcnt == 30) PlayerInfo[playerid][pJailTime] = strval(Field);
            if (rcnt == 31) PlayerInfo[playerid][pMats] = strval(Field);
            if (rcnt == 32) PlayerInfo[playerid][pDrugs] = strval(Field);
            if (rcnt == 33) PlayerInfo[playerid][pLeader] = strval(Field);
            if (rcnt == 34) PlayerInfo[playerid][pMember] = strval(Field);
            if (rcnt == 35) PlayerInfo[playerid][pFMember] = strval(Field);
            if (rcnt == 36) PlayerInfo[playerid][pRank] = strval(Field);
            if (rcnt == 37) PlayerInfo[playerid][pChar] = strval(Field);
            if (rcnt == 38) PlayerInfo[playerid][pContractTime] = strval(Field);
            if (rcnt == 39) PlayerInfo[playerid][pDetSkill] = strval(Field);
            if (rcnt == 40) PlayerInfo[playerid][pSexSkill] = strval(Field);
            if (rcnt == 41) PlayerInfo[playerid][pBoxSkill] = strval(Field);
            if (rcnt == 42) PlayerInfo[playerid][pLawSkill] = strval(Field);
            if (rcnt == 43) PlayerInfo[playerid][pMechSkill] = strval(Field);
            if (rcnt == 44) PlayerInfo[playerid][pJackSkill] = strval(Field);
            if (rcnt == 45) PlayerInfo[playerid][pCarSkill] = strval(Field);
            if (rcnt == 46) PlayerInfo[playerid][pNewsSkill] = strval(Field);
            if (rcnt == 47) PlayerInfo[playerid][pDrugsSkill] = strval(Field);
            if (rcnt == 48) PlayerInfo[playerid][pCookSkill] = strval(Field);
            if (rcnt == 49) PlayerInfo[playerid][pFishSkill] = strval(Field);
            if (rcnt == 50) PlayerInfo[playerid][pSHealth] = strval(Field);
            if (rcnt == 51) PlayerInfo[playerid][pHealth] = strval(Field);
            if (rcnt == 52) PlayerInfo[playerid][pInt] = strval(Field);
            if (rcnt == 53) PlayerInfo[playerid][pLocal] = strval(Field);
            if (rcnt == 54) PlayerInfo[playerid][pTeam] = strval(Field);
            if (rcnt == 55) PlayerInfo[playerid][pModel] = strval(Field);
            if (rcnt == 56) PlayerInfo[playerid][pPnumber] = strval(Field);
            if (rcnt == 57) PlayerInfo[playerid][pPhousekey] = strval(Field);
            if (rcnt == 58) PlayerInfo[playerid][pPbiskey] = strval(Field);
            if (rcnt == 59) PlayerInfo[playerid][pPos_x] = strval(Field);
            if (rcnt == 60) PlayerInfo[playerid][pPos_y] = strval(Field);
            if (rcnt == 61) PlayerInfo[playerid][pPos_z] = strval(Field);
            if (rcnt == 62) PlayerInfo[playerid][pCarLic] = strval(Field);
            if (rcnt == 63) PlayerInfo[playerid][pFlyLic] = strval(Field);
            if (rcnt == 64) PlayerInfo[playerid][pBoatLic] = strval(Field);
            if (rcnt == 65) PlayerInfo[playerid][pFishLic] = strval(Field);
            if (rcnt == 66) PlayerInfo[playerid][pGunLic] = strval(Field);
            if (rcnt == 67) PlayerInfo[playerid][pGun1] = strval(Field);
            if (rcnt == 68) PlayerInfo[playerid][pGun2] = strval(Field);
            if (rcnt == 69) PlayerInfo[playerid][pGun3] = strval(Field);
            if (rcnt == 70) PlayerInfo[playerid][pGun4] = strval(Field);
            if (rcnt == 71) PlayerInfo[playerid][pAmmo1] = strval(Field);
            if (rcnt == 72) PlayerInfo[playerid][pCarTime] = strval(Field);
            if (rcnt == 73) PlayerInfo[playerid][pPayDayHad] = strval(Field);
            if (rcnt == 74) PlayerInfo[playerid][pCDPlayer] = strval(Field);
            if (rcnt == 75) PlayerInfo[playerid][pWins] = strval(Field);
            if (rcnt == 76) PlayerInfo[playerid][pLoses] = strval(Field);
            if (rcnt == 77) PlayerInfo[playerid][pAlcoholPerk] = strval(Field);
            if (rcnt == 78) PlayerInfo[playerid][pDrugPerk] = strval(Field);
            if (rcnt == 79) PlayerInfo[playerid][pMiserPerk] = strval(Field);
            if (rcnt == 80) PlayerInfo[playerid][pPainPerk] = strval(Field);
            if (rcnt == 81) PlayerInfo[playerid][pTraderPerk] = strval(Field);
            if (rcnt == 82) PlayerInfo[playerid][pTut] = strval(Field);
            if (rcnt == 83) PlayerInfo[playerid][pMissionNr] = strval(Field);
            if (rcnt == 84) PlayerInfo[playerid][pWarns] = strval(Field);
            if (rcnt == 85) PlayerInfo[playerid][pAdjustable] = strval(Field);
            if (rcnt == 86) PlayerInfo[playerid][pFuel] = strval(Field);
            if (rcnt == 87) PlayerInfo[playerid][pMarried] = strval(Field);
            if (rcnt == 88) PlayerInfo[playerid][pMarriedTo] = strval(Field);
            rcnt++;
        }
        samp_mysql_free_result();
    }
    else
    {
        new loginstring[128],loginname[64];
        GetPlayerName(playerid,loginname,sizeof(loginname));
        format(loginstring,sizeof(loginstring),"{FFFFFF}Wrong password, please type correct password.",loginname);
        ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"{FFFFFF}Login",loginstring,"Login","Exit");
        gPlayerLogTries[playerid] += 1;
        if(gPlayerLogTries[playerid] == 4) { Ban(playerid); }
        return 1;
    }
    PlayerInfo[playerid][pAdjustable] = 0;
    ResetPlayerMoney(playerid);
    ConsumingMoney[playerid] = 1;
    GivePlayerMoney(playerid,PlayerInfo[playerid][pCash]);
    CurrentMoney[playerid] = PlayerInfo[playerid][pCash];
    if(PlayerInfo[playerid][pReg] == 0)
    {
        PlayerInfo[playerid][pLevel] = 1;
        PlayerInfo[playerid][pSHealth] = 0.0;
        PlayerInfo[playerid][pHealth] = 50.0;
        PlayerInfo[playerid][pPos_x] = 2246.6;
        PlayerInfo[playerid][pPos_y] = -1161.9;
        PlayerInfo[playerid][pPos_z] = 1029.7;
        PlayerInfo[playerid][pInt] = 15;
        PlayerInfo[playerid][pLocal] = 255;
        PlayerInfo[playerid][pTeam] = 3;
        PlayerInfo[playerid][pModel] = 264;
        new randphone = 1000 + random(8999);//minimum 1000  max 9999 //giving one at the start
        PlayerInfo[playerid][pPnumber] = randphone;
        PlayerInfo[playerid][pPhousekey] = 255;
        PlayerInfo[playerid][pPbiskey] = 255;
        PlayerInfo[playerid][pAccount] = 50000;
        PlayerInfo[playerid][pReg] = 1;
        GivePlayerMoney(playerid, 5000);
    }
    format(string2, sizeof(string2), "SERVER: Welcome %s",playername2);
    SendClientMessage(playerid, COLOR_WHITE,string2);
    printf("%s has logged in.",playername2);
    if (PlayerInfo[playerid][pDonateRank] > 0)
    {
        SendClientMessage(playerid, COLOR_WHITE,"SERVER: You are a Premium Account user.");
    }
    if (PlayerInfo[playerid][pAdmin] > 0)
    {
        format(string2, sizeof(string2), "SERVER: You are logged in as a Level %d Admin.",PlayerInfo[playerid][pAdmin]);
        SendClientMessage(playerid, COLOR_WHITE,string2);
    }
    SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pModel], PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z], 1.0, -1, -1, -1, -1, -1, -1);
    if(gTeam[playerid] == 0)
    {
        gTeam[playerid] = 3;
    }
    else
    {
        gTeam[playerid] = PlayerInfo[playerid][pTeam];
    }
    gPlayerLogged[playerid] = 1;
    SpawnPlayer(playerid);
    format(tmp2, sizeof(tmp2), "~w~Welcome ~n~~y~   %s", playername2);
    DateProp(playerid);
    GameTextForPlayer(playerid, tmp2, 5000, 1);
    SendClientMessage(playerid, COLOR_YELLOW, motd);
    if(PlayerInfo[playerid][pFMember] < 255)
    {
        format(tmp2, sizeof(tmp2), "Family MOTD: %s.", FamilyInfo[PlayerInfo[playerid][pFMember]][FamilyMOTD]);
        SendClientMessage(playerid, COLOR_YELLOW, tmp2);
    }
    return 1;
}
when I press "login" server closes


Re: MySQL problem - Kaylux - 04.01.2011

It's easier if you post the server log and the mysql log.


Re: MySQL problem - exDDDD - 04.01.2011

17:11:53] Incoming connection: 192.168.1.2:2534
[17:11:53] [join] eXtrike has joined the server (0:192.168.1.2)

mysql log where is it?


Re: MySQL problem - DVDK - 04.01.2011

Quote:
Originally Posted by exDDDD
Посмотреть сообщение
17:11:53] Incoming connection: 192.168.1.2:2534
[17:11:53] [join] eXtrike has joined the server (0:192.168.1.2)

mysql log where is it?
In your root map.


Re: MySQL problem - xxmitsu - 04.01.2011

I don't think that the plugin that he uses creates a mysql_log.


Re: MySQL problem - _rAped - 04.01.2011

Choose another non-retarded MySQL plugin.


Re: MySQL problem - Kaylux - 04.01.2011

Theres usually a function to start logging mysql actions. mysql_debug?


Re: MySQL problem - _rAped - 04.01.2011

Quote:
Originally Posted by Kaylux
Посмотреть сообщение
Theres usually a function to start logging mysql actions. mysql_debug?
Depends on the plugin, either mysql_debug, samp_mysql_debug or mysql_init. (For the plugins I know.)


Re: MySQL problem - exDDDD - 04.01.2011

pawn Код:
10104 17:15:16 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use Windows interlocked functions
InnoDB: Compressed tables use zlib 1.2.3
110104 17:15:16  InnoDB: Initializing buffer pool, size = 128.0M
110104 17:15:16  InnoDB: Completed initialization of buffer pool
110104 17:15:16  InnoDB: highest supported file format is Barracuda.
110104 17:15:19  InnoDB: 1.1.4 started; log sequence number 2137067
110104 17:15:21 [Note] Event Scheduler: Loaded 0 events
110104 17:15:21 [Note] wampmysqld: ready for connections.
Version: '5.5.8-log'  socket: ''  port: 3306  MySQL Community Server (GPL)
110104 19:00:36 [Note] wampmysqld: Normal shutdown

110104 19:00:36 [Note] Event Scheduler: Purging the queue. 0 events
110104 19:00:36  InnoDB: Starting shutdown...
110104 19:00:37  InnoDB: Shutdown completed; log sequence number 2142628
110104 19:00:37 [Note] wampmysqld: Shutdown complete

110104 19:00:43 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use Windows interlocked functions
InnoDB: Compressed tables use zlib 1.2.3
110104 19:00:43  InnoDB: Initializing buffer pool, size = 128.0M
110104 19:00:43  InnoDB: Completed initialization of buffer pool
110104 19:00:43  InnoDB: highest supported file format is Barracuda.
110104 19:00:46  InnoDB: 1.1.4 started; log sequence number 2142628
110104 19:00:47 [Note] Event Scheduler: Loaded 0 events
110104 19:00:47 [Note] wampmysqld: ready for connections.
Version: '5.5.8-log'  socket: ''  port: 3306  MySQL Community Server (GPL)



Re: MySQL problem - _rAped - 04.01.2011

Quote:
Originally Posted by exDDDD
Посмотреть сообщение
pawn Код:
10104 17:15:16 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use Windows interlocked functions
InnoDB: Compressed tables use zlib 1.2.3
110104 17:15:16  InnoDB: Initializing buffer pool, size = 128.0M
110104 17:15:16  InnoDB: Completed initialization of buffer pool
110104 17:15:16  InnoDB: highest supported file format is Barracuda.
110104 17:15:19  InnoDB: 1.1.4 started; log sequence number 2137067
110104 17:15:21 [Note] Event Scheduler: Loaded 0 events
110104 17:15:21 [Note] wampmysqld: ready for connections.
Version: '5.5.8-log'  socket: ''  port: 3306  MySQL Community Server (GPL)
110104 19:00:36 [Note] wampmysqld: Normal shutdown

110104 19:00:36 [Note] Event Scheduler: Purging the queue. 0 events
110104 19:00:36  InnoDB: Starting shutdown...
110104 19:00:37  InnoDB: Shutdown completed; log sequence number 2142628
110104 19:00:37 [Note] wampmysqld: Shutdown complete

110104 19:00:43 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use Windows interlocked functions
InnoDB: Compressed tables use zlib 1.2.3
110104 19:00:43  InnoDB: Initializing buffer pool, size = 128.0M
110104 19:00:43  InnoDB: Completed initialization of buffer pool
110104 19:00:43  InnoDB: highest supported file format is Barracuda.
110104 19:00:46  InnoDB: 1.1.4 started; log sequence number 2142628
110104 19:00:47 [Note] Event Scheduler: Loaded 0 events
110104 19:00:47 [Note] wampmysqld: ready for connections.
Version: '5.5.8-log'  socket: ''  port: 3306  MySQL Community Server (GPL)
This is your actual MySQL server log not the plugin log?