02.12.2010, 20:38
Alright, I have been learning and scripting MySQL recent days, but I don't know, every time I try to login, my server crashes under it, maybe any of you have a suggestion? Thanks !
Everything saves correctly and the password check works too, but to get the rest of the data, it crashes.
Код:
public OnPlayerLogin(playerid,password[]) { IsDatabaseConnected(); new tmp2[256]; new playername2[MAX_PLAYER_NAME]; new playernamesplit[3][MAX_PLAYER_NAME]; GetPlayerName(playerid, playername2, sizeof(playername2)); format(tmp2, sizeof(tmp2), "SELECT COUNT(*) FROM players WHERE Name='%s'", playername2); samp_mysql_query(tmp2); samp_mysql_store_result(); samp_mysql_fetch_row(tmp2); new registered = strval(tmp2); if (registered < 1) { SendClientMessage(playerid, COLOR_LIGHTRED, "You are not registered. Use /register <password> to create new user."); return 0; } samp_mysql_free_result(); split(playername2, playernamesplit, '_'); MySQLFetchAcctSingle(Account[playerid][pSQLID], "Password", Account[playerid][pKey]); if(strcmp(Account[playerid][pKey],password, true ) == 0 ) { new line[2048], string[128], query[256]; mysql_real_escape_string(playername2, playername2); format(query, sizeof(query), "SELECT * FROM `players` WHERE Name = '%s'", playername2); mysql_query(query); mysql_store_result(); mysql_fetch_row_format(line, "|"); sscanf(line, "p|iiifffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiiiiiiiiiiiiiiiiiiiis[128]is[128]is[128]is[128]is[128]iiiiiiiiiiiiiiiiiis[128]is[128]is[128]is[128]is[128]is[128]iiiiiii", Account[playerid][pSQLID], Account[playerid][pName], Account[playerid][pCrashed],CrashPos[playerid][0], CrashPos[playerid][1], CrashPos[playerid][2], Account[playerid][pBankCard], Account[playerid][pBankPin], Account[playerid][pAdmin], Account[playerid][pMask], Account[playerid][pDonateRank], Account[playerid][pDrugs], Account[playerid][pReg], Account[playerid][pSex], Account[playerid][pAge], Account[playerid][pHungry], Account[playerid][pOrigin], Account[playerid][pSpawn], Account[playerid][pMuted], Account[playerid][pExp], Account[playerid][pCash], Account[playerid][pAccount], Account[playerid][pWatch], Account[playerid][pPDA], Account[playerid][pFuel], Account[playerid][pRod], Account[playerid][pJob], Account[playerid][pPayCheck], Account[playerid][pHeadValue], Account[playerid][pJailed], Account[playerid][pJailTime], Account[playerid][pMats], Account[playerid][pLeader], Account[playerid][pGMember], Account[playerid][pMember], Account[playerid][pFMember], Account[playerid][pRank], Account[playerid][pGRank], Account[playerid][pPayDay], Account[playerid][pPayDayHad], Account[playerid][pDays], Account[playerid][pHour], Account[playerid][pPayDayTime], Account[playerid][pMatsHolding], Account[playerid][pSHealth], Account[playerid][pHealth], Account[playerid][pInt], Account[playerid][pLocal], Account[playerid][pTeam], Account[playerid][pModel], Account[playerid][pPnumber], Account[playerid][pPhousekey], Account[playerid][pPbiskey], Account[playerid][pGun0], Account[playerid][pGun1], Account[playerid][pGun2], Account[playerid][pAmmo0], Account[playerid][pAmmo1], Account[playerid][pAmmo2], Account[playerid][pBanned], Account[playerid][pCarLic], Account[playerid][pFlyLic], Account[playerid][pBoatLic], Account[playerid][pGunLic], Account[playerid][pPen], Account[playerid][pNoteTaken1], Account[playerid][pNote1], Account[playerid][pNoteTaken2], Account[playerid][pNote2], Account[playerid][pNoteTaken3], Account[playerid][pNote3], Account[playerid][pNoteTaken4], Account[playerid][pNote4], Account[playerid][pNoteTaken5], Account[playerid][pNote5], Account[playerid][pTut], Account[playerid][pRadioFrequency], Account[playerid][pSkate], Account[playerid][pPcarkey1], Account[playerid][pPcarkey2], Account[playerid][pPcarkey3], Account[playerid][pPwine], Account[playerid][pPrag], Account[playerid][pPlighter], Account[playerid][pPcigarette], Account[playerid][pCarLicS], Account[playerid][pFlyLicS], Account[playerid][pBoatLicS], Account[playerid][pGunLicS], Account[playerid][pCarlock], Account[playerid][pDrugName], Account[playerid][pRadio], Account[playerid][pPhoneNumber1], Account[playerid][pPhoneContact1], Account[playerid][pPhoneNumber2], Account[playerid][pPhoneContact2], Account[playerid][pPhoneNumber3], Account[playerid][pPhoneContact3], Account[playerid][pPhoneNumber4], Account[playerid][pPhoneContact4], Account[playerid][pPhoneNumber5], Account[playerid][pPhoneContact5], Account[playerid][pWantedLevel], Account[playerid][pWantedReason], Account[playerid][pQuitOnCar], Account[playerid][pHelper], Account[playerid][pAjails], Account[playerid][pKicks], Account[playerid][pBans], Account[playerid][pRentKey], Account[playerid][pBanned]); mysql_free_result(); } else { SendClientMessage(playerid, COLOR_WHITE, "SERVER: Password does not match your name."); gPlayerLogTries[playerid] += 1; if(gPlayerLogTries[playerid] == 4) { Ban(playerid); } return 1; }