Sscanf or Mysql_Get_Field?
#1

Hey!

I have a problem, with sscanf, not every variable is correct, and with Mysql_Get_Field, it crash. (MySQL, Big database ;p)

Mysql_Get_Field (Mysql_Fetch_Field_Row = Mysql_get_field, click)

Code:
http://pastebin.com/kX05NuJ5

Server Log:
Quote:

[16:07:57] [join] Randy_White has joined the server (0:{hide})

CrashDetect:
Quote:

Plugin succesfully loaded (version 3.1.3)
The server has been crashed by native mysql_fetch_field_row at address 85e8 in script {hide}.

Sscanf:
http://pastebin.com/NAptdF1z

Server log
Quote:

[16:42:39] Sscanf 1 start.
[16:42:39] sscanf warning: Format specifier does not match parameter count.
[16:42:39] Sscanf 1 ready, 2 start.
[16:42:39] sscanf warning: Format specifier does not match parameter count.
[16:42:39] Sscanf 2 ready, 3 start.
[16:42:39] Sscanf 3 ready.
[16:42:39] Mysql_Login spawned, X: -2334.560058 Y: -2.679699 Z: 350.865997 R: 0.000000
[16:42:47] [death] Randy_White died 54 [SpawnPoint was in the air.]
[16:43:07] [death] Randy_White died 255 [SpawnPoint was in the air.]
[16:44:05] 1, 0, 0, 0, 0, 0, 0, 20, 100000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
[16:44:05] 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100.000000, 50.000000, 0, 0, 0, 0, 1685.680053, -2334.560058, -2.679699, 350.865997, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
[16:44:05] 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

/log command (Output in the server log)
pawn Код:
CMD:log(playerid, params[])
{
        printf("%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %s, %s, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i",
        PlayerInfo[playerid][pLevel],
        PlayerInfo[playerid][pAdmin],
        PlayerInfo[playerid][pDonateRank],
        PlayerInfo[playerid][gPupgrade],
        PlayerInfo[playerid][pConnectTime],
        PlayerInfo[playerid][pReg],
        PlayerInfo[playerid][pSex],
        PlayerInfo[playerid][pAge],
        PlayerInfo[playerid][pCash],
        PlayerInfo[playerid][pHospital],
        PlayerInfo[playerid][pMuted],
        PlayerInfo[playerid][pPrisonReason],
        PlayerInfo[playerid][pPrisonedBy],
        PlayerInfo[playerid][pRMuted],
        PlayerInfo[playerid][pRMutedTotal],
        PlayerInfo[playerid][pRMutedTime],
        PlayerInfo[playerid][pVMuted],
        PlayerInfo[playerid][pVMutedTime],
        PlayerInfo[playerid][pFactionModerator],
        PlayerInfo[playerid][pGangModerator],
        PlayerInfo[playerid][pExp],
        PlayerInfo[playerid][pCrimes],
        PlayerInfo[playerid][pKills],
        PlayerInfo[playerid][pDeaths],
        PlayerInfo[playerid][pArrested],
        PlayerInfo[playerid][pWantedDeaths],
        PlayerInfo[playerid][pPhoneBook],
        PlayerInfo[playerid][pPhonenr],
        PlayerInfo[playerid][pLottoNr],
        PlayerInfo[playerid][pToggedVIPChat],
        PlayerInfo[playerid][pPhonePrivacy],
        PlayerInfo[playerid][pNMute],
        PlayerInfo[playerid][pNMuteTotal],
        PlayerInfo[playerid][pADMute],
        PlayerInfo[playerid][pADMuteTotal],
        PlayerInfo[playerid][pHelpMute],
        PlayerInfo[playerid][pPayCheck],
        PlayerInfo[playerid][pHeadValue],
        PlayerInfo[playerid][pJailed],
        PlayerInfo[playerid][pJailTime]);

        printf("%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %f, %f, %i, %i, %i, %i, %f, %f, %f, %f, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %s, %i, %i, %i, %i",
        PlayerInfo[playerid][pMats],
        PlayerInfo[playerid][pPackages],
        PlayerInfo[playerid][pLeader],
        PlayerInfo[playerid][pMember],
        PlayerInfo[playerid][pDivision],
        PlayerInfo[playerid][pFMember],
        PlayerInfo[playerid][pSpeakerPhone],
        PlayerInfo[playerid][pRank],
        PlayerInfo[playerid][pWantedLevel],
        PlayerInfo[playerid][pPot],
        PlayerInfo[playerid][pCrack],
        PlayerInfo[playerid][pHelper],
        PlayerInfo[playerid][pHealth],
        PlayerInfo[playerid][pArmor],
        PlayerInfo[playerid][pInt],
        PlayerInfo[playerid][pLocal],
        PlayerInfo[playerid][pTeam],
        PlayerInfo[playerid][pPnumber],
        PlayerInfo[playerid][pPos_x],
        PlayerInfo[playerid][pPos_y],
        PlayerInfo[playerid][pPos_z],
        PlayerInfo[playerid][pPos_r],
        PlayerInfo[playerid][pCarLic],
        PlayerInfo[playerid][pFlyLic],
        PlayerInfo[playerid][pBoatLic],
        PlayerInfo[playerid][pFishLic],
        PlayerInfo[playerid][pGunLic],
        PlayerInfo[playerid][pCDPlayer],
        PlayerInfo[playerid][pWins],
        PlayerInfo[playerid][pLoses],
        PlayerInfo[playerid][pTut],
        PlayerInfo[playerid][pWarns],
        PlayerInfo[playerid][pMarried],
        PlayerInfo[playerid][pC4],
        PlayerInfo[playerid][pC4Get],
        PlayerInfo[playerid][pC4Used],
        PlayerInfo[playerid][pMarriedTo],
        PlayerInfo[playerid][pSprunk],
        PlayerInfo[playerid][pCigar],
        PlayerInfo[playerid][pPole]);

        printf("%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %s, %s, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i",
        PlayerInfo[playerid][pSpraycan],
        PlayerInfo[playerid][pRope],
        PlayerInfo[playerid][pDice],
        PlayerInfo[playerid][pBombs],
        PlayerInfo[playerid][pDuty],
        PlayerInfo[playerid][pFightStyle],
        PlayerInfo[playerid][pBanned],
        PlayerInfo[playerid][pPermaBanned],
        PlayerInfo[playerid][pDisabled],
        PlayerInfo[playerid][pAccent],
        PlayerInfo[playerid][pCHits],
        PlayerInfo[playerid][pFHits],
        PlayerInfo[playerid][pCrates],
        PlayerInfo[playerid][pVW],
        PlayerInfo[playerid][pClothes],
        PlayerInfo[playerid][pTempVIP],
        PlayerInfo[playerid][pTokens],
        PlayerInfo[playerid][pDrugsTime],
        PlayerInfo[playerid][pLawyerTime],
        PlayerInfo[playerid][pGangWarn],
        PlayerInfo[playerid][pFactionBanned],
        PlayerInfo[playerid][pMechTime],
        PlayerInfo[playerid][pSexTime],
        PlayerInfo[playerid][pLawyerFreeTime],
        PlayerInfo[playerid][pContractBy],
        PlayerInfo[playerid][pContractDetail],
        PlayerInfo[playerid][pBanAppealer],
        PlayerInfo[playerid][pUndercover],
        PlayerInfo[playerid][pTogReports],
        PlayerInfo[playerid][pRadio],
        PlayerInfo[playerid][pRadioFreq],
        PlayerInfo[playerid][pDutyHours],
        PlayerInfo[playerid][pAcceptedHelp],
        PlayerInfo[playerid][pAcceptReport],
        PlayerInfo[playerid][pTrashReport],
        PlayerInfo[playerid][pTriageTime],
        PlayerInfo[playerid][pTaxiLicense],
        PlayerInfo[playerid][pTicketTime],
        PlayerInfo[playerid][pWristwatch],
        PlayerInfo[playerid][pSurveillance],
        PlayerInfo[playerid][pTire],
        PlayerInfo[playerid][pFirstaid],
        PlayerInfo[playerid][pRccam],
        PlayerInfo[playerid][pReceiver],
        PlayerInfo[playerid][pGPS],
        PlayerInfo[playerid][pSweep],
        PlayerInfo[playerid][pSweepLeft],
        PlayerInfo[playerid][pBugged],
        PlayerInfo[playerid][pCallsAccepted],
        PlayerInfo[playerid][pLiveBanned],
        PlayerInfo[playerid][pServiceTime]);
        return 1;
}

MySQL
G-sTyLeZzZ

Database:
PHP код:
CREATE TABLE IF NOT EXISTS `users` (
  `
idint(11NOT NULL AUTO_INCREMENT,
  `
namevarchar(30) DEFAULT NULL,
  `
passwordvarchar(255) DEFAULT NULL,
  `
ipvarchar(39NOT NULL,
  `
Levelint(10) DEFAULT '1',
  `
Adminint(10) DEFAULT '0',
  `
DonateRankint(10) DEFAULT '0',
  `
pupgradeint(10) DEFAULT '0',
  `
ConnectTimeint(10) DEFAULT '0',
  `
Regint(10) DEFAULT '0',
  `
Sexint(10) DEFAULT '0',
  `
Ageint(10) DEFAULT '20',
  `
Cashint(10) DEFAULT '100000',
  `
Hospitalint(10) DEFAULT '0',
  `
Mutedint(10) DEFAULT '0',
  `
PrisonReasonvarchar(128NOT NULL DEFAULT '0',
  `
PrisonedByvarchar(30NOT NULL DEFAULT '0',
  `
RMutedint(10) DEFAULT '0',
  `
RMutedTotalint(10) DEFAULT '0',
  `
RMutedTimeint(10) DEFAULT '0',
  `
VMutedint(10) DEFAULT '0',
  `
VMutedTimeint(10) DEFAULT '0',
  `
FactionModeratorint(10) DEFAULT '0',
  `
GangModeratorint(10) DEFAULT '0',
  `
Expint(10) DEFAULT '0',
  `
Crimesint(10) DEFAULT '0',
  `
Killsint(10) DEFAULT '0',
  `
Deathsint(10) DEFAULT '0',
  `
Arrestedint(10) DEFAULT '0',
  `
WantedDeathsint(10) DEFAULT '0',
  `
PhoneBookint(10) DEFAULT '0',
  `
LottoNrint(10) DEFAULT '0',
  `
ToggedVIPChatint(10) DEFAULT '0',
  `
PhonePrivacyint(10) DEFAULT '0',
  `
NMuteint(10) DEFAULT '0',
  `
NMuteTotalint(10) DEFAULT '0',
  `
ADMuteint(10) DEFAULT '0',
  `
ADMuteTotalint(10) DEFAULT '0',
  `
HelpMuteint(10) DEFAULT '0',
  `
PayCheckint(10) DEFAULT '0',
  `
HeadValueint(10) DEFAULT '0',
  `
Jailedint(10) DEFAULT '0',
  `
JailTimeint(10) DEFAULT '0',
  `
Matsint(10) DEFAULT '0',
  `
Packagesint(10) DEFAULT '0',
  `
Leaderint(10) DEFAULT '0',
  `
Memberint(10) DEFAULT '0',
  `
Divisionint(10) DEFAULT '0',
  `
FMemberint(10) DEFAULT '0',
  `
SpeakerPhoneint(10) DEFAULT '0',
  `
Rankint(10) DEFAULT '0',
  `
WantedLevelint(10) DEFAULT '0',
  `
Potint(10) DEFAULT '0',
  `
Crackint(10) DEFAULT '0',
  `
Helperint(10) DEFAULT '0',
  `
Healthfloat NOT NULL DEFAULT '100',
  `
Armorfloat NOT NULL DEFAULT '50',
  `
Interiorint(10) DEFAULT '0',
  `
Localint(10) DEFAULT '0',
  `
Teamint(10) DEFAULT '0',
  `
Pnumberint(10) DEFAULT '0',
  `
Posxfloat NOT NULL DEFAULT '1685.68',
  `
Posyfloat NOT NULL DEFAULT '-2334.56',
  `
Poszfloat NOT NULL DEFAULT '-2.6797',
  `
Posrfloat NOT NULL DEFAULT '350.866',
  `
CarLicint(10) DEFAULT '0',
  `
FlyLicint(10) DEFAULT '0',
  `
BoatLicint(10) DEFAULT '0',
  `
FishLicint(10) DEFAULT '0',
  `
GunLicint(10) DEFAULT '0',
  `
CDPlayerint(10) DEFAULT '0',
  `
Winsint(10) DEFAULT '0',
  `
Losesint(10) DEFAULT '0',
  `
Tutint(10) DEFAULT '0',
  `
Warnsint(10) DEFAULT '0',
  `
Marriedint(10) DEFAULT '0',
  `
C4int(10) DEFAULT '0',
  `
C4Getint(10) DEFAULT '0',
  `
C4Usedint(10) DEFAULT '0',
  `
MarriedTovarchar(128NOT NULL DEFAULT '0',
  `
Sprunkint(10) DEFAULT '0',
  `
Cigarint(10) DEFAULT '0',
  `
Poleint(10) DEFAULT '0',
  `
Spraycanint(10) DEFAULT '0',
  `
Ropeint(10) DEFAULT '0',
  `
Diceint(10) DEFAULT '0',
  `
Bombsint(10) DEFAULT '0',
  `
Dutyint(10) DEFAULT '0',
  `
FightStyleint(10) DEFAULT '0',
  `
Bannedint(10) DEFAULT '0',
  `
PermaBannedint(10) DEFAULT '0',
  `
Disabledint(10) DEFAULT '0',
  `
Accentint(10) DEFAULT '0',
  `
CHitsint(10) DEFAULT '0',
  `
FHitsint(10) DEFAULT '0',
  `
Cratesint(10) DEFAULT '0',
  `
VWint(10) DEFAULT '0',
  `
Clothesint(10) DEFAULT '0',
  `
TempVIPint(10) DEFAULT '0',
  `
Tokensint(10) DEFAULT '0',
  `
DrugsTimeint(10) DEFAULT '0',
  `
LawyerTimeint(10) DEFAULT '0',
  `
GangWarnint(10) DEFAULT '0',
  `
FactionBannedint(10) DEFAULT '0',
  `
MechTimeint(10) DEFAULT '0',
  `
SexTimeint(10) DEFAULT '0',
  `
LawyerFreeTimeint(10) DEFAULT '0',
  `
ContractByvarchar(32NOT NULL DEFAULT '0',
  `
ContractDetailvarchar(64NOT NULL DEFAULT '0',
  `
BanAppealerint(10) DEFAULT '0',
  `
Undercoverint(10) DEFAULT '0',
  `
TogReportsint(10) DEFAULT '0',
  `
Radioint(10) DEFAULT '0',
  `
RadioFreqint(10) DEFAULT '0',
  `
DutyHoursint(10) DEFAULT '0',
  `
AcceptedHelpint(10) DEFAULT '0',
  `
AcceptReportint(10) DEFAULT '0',
  `
TrashReportint(10) DEFAULT '0',
  `
TriageTimeint(10) DEFAULT '0',
  `
TaxiLicenseint(10) DEFAULT '0',
  `
TicketTimeint(10) DEFAULT '0',
  `
Wristwatchint(10) DEFAULT '0',
  `
Surveillanceint(10) DEFAULT '0',
  `
Tireint(10) DEFAULT '0',
  `
Firstaidint(10) DEFAULT '0',
  `
Rccamint(10) DEFAULT '0',
  `
Receiverint(10) DEFAULT '0',
  `
GPSint(10) DEFAULT '0',
  `
Sweepint(10) DEFAULT '0',
  `
SweepLeftint(10) DEFAULT '0',
  `
Buggedint(10) DEFAULT '0',
  `
CallsAcceptedint(10) DEFAULT '0',
  `
LiveBannedint(10) DEFAULT '0',
  `
ServiceTimeint(10) DEFAULT '0',
  
PRIMARY KEY (`id`)
ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1
Debug log:
Quote:

[15:58:14]

[15:58:14] ---------------------------

[15:58:14] MySQL Debugging activated (09/14/11)

[15:58:14] ---------------------------

[15:58:14]

[15:59:00] >> mysql_query( Connection handle: 1 )

[15:59:01] CMySQLHandler::Query(SELECT id FROM `users` WHERE name = 'Randy_White' LIMIT 1) - Successfully executed.

[15:59:01] >> mysql_store_result( Connection handle: 1 )

[15:59:01] CMySQLHandler::StoreResult() - Result was stored.

[15:59:01] >> mysql_num_rows( Connection handle: 1 )

[15:59:01] CMySQLHandler::NumRows() - Returned 1 row(s)

[15:59:01] >> mysql_free_result( Connection handle: 1 )

[15:59:01] CMySQLHandler::FreeResult() - Result was successfully free'd.

[15:59:03] >> mysql_real_escape_string( Connection handle: 1 )

[15:59:03] CMySQLHandler::EscapeString({hide}); - Escaped {hide} characters to {hide}.

[15:59:03] >> mysql_query( Connection handle: 1 )

[15:59:03] CMySQLHandler::Query(SELECT `name` FROM users WHERE name = 'Randy_White' AND password = SHA1('{Hide}')) - Successfully executed.

[15:59:03] >> mysql_store_result( Connection handle: 1 )

[15:59:03] CMySQLHandler::StoreResult() - Result was stored.

[15:59:03] >> mysql_num_rows( Connection handle: 1 )

[15:59:03] CMySQLHandler::NumRows() - Returned 1 row(s)

[15:59:03] >> mysql_query( Connection handle: 1 )

[15:59:03] CMySQLHandler::Query(SELECT * FROM users WHERE name='Randy_White' LIMIT 1) - Successfully executed.

[15:59:03] >> mysql_store_result( Connection handle: 1 )

[15:59:03] CMySQLHandler::StoreResult() - Result was stored.

[15:59:03] >> mysql_retrieve_row( Connection handle: 1 )

[15:59:03] >> mysql_fetch_field_row( Connection handle: 1 ) [Here it crash when i use Mysql get field]
Somebody knows to fix sscanf or mysql get field?
It's my login system, so, it need to work ..

Thanks anyways!
Wouter.
Reply
#2

Like strings? i got every time a problem with the strings. (Sscanf ;s)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)