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` (
  `
id` int(11) NOT NULL AUTO_INCREMENT,
  `
name` varchar(30) DEFAULT NULL,
  `
password` varchar(255) DEFAULT NULL,
  `
ip` varchar(39) NOT NULL,
  `
Level` int(10) DEFAULT '1',
  `
Admin` int(10) DEFAULT '0',
  `
DonateRank` int(10) DEFAULT '0',
  `
pupgrade` int(10) DEFAULT '0',
  `
ConnectTime` int(10) DEFAULT '0',
  `
Reg` int(10) DEFAULT '0',
  `
Sex` int(10) DEFAULT '0',
  `
Age` int(10) DEFAULT '20',
  `
Cash` int(10) DEFAULT '100000',
  `
Hospital` int(10) DEFAULT '0',
  `
Muted` int(10) DEFAULT '0',
  `
PrisonReason` varchar(128) NOT NULL DEFAULT '0',
  `
PrisonedBy` varchar(30) NOT NULL DEFAULT '0',
  `
RMuted` int(10) DEFAULT '0',
  `
RMutedTotal` int(10) DEFAULT '0',
  `
RMutedTime` int(10) DEFAULT '0',
  `
VMuted` int(10) DEFAULT '0',
  `
VMutedTime` int(10) DEFAULT '0',
  `
FactionModerator` int(10) DEFAULT '0',
  `
GangModerator` int(10) DEFAULT '0',
  `
Exp` int(10) DEFAULT '0',
  `
Crimes` int(10) DEFAULT '0',
  `
Kills` int(10) DEFAULT '0',
  `
Deaths` int(10) DEFAULT '0',
  `
Arrested` int(10) DEFAULT '0',
  `
WantedDeaths` int(10) DEFAULT '0',
  `
PhoneBook` int(10) DEFAULT '0',
  `
LottoNr` int(10) DEFAULT '0',
  `
ToggedVIPChat` int(10) DEFAULT '0',
  `
PhonePrivacy` int(10) DEFAULT '0',
  `
NMute` int(10) DEFAULT '0',
  `
NMuteTotal` int(10) DEFAULT '0',
  `
ADMute` int(10) DEFAULT '0',
  `
ADMuteTotal` int(10) DEFAULT '0',
  `
HelpMute` int(10) DEFAULT '0',
  `
PayCheck` int(10) DEFAULT '0',
  `
HeadValue` int(10) DEFAULT '0',
  `
Jailed` int(10) DEFAULT '0',
  `
JailTime` int(10) DEFAULT '0',
  `
Mats` int(10) DEFAULT '0',
  `
Packages` int(10) DEFAULT '0',
  `
Leader` int(10) DEFAULT '0',
  `
Member` int(10) DEFAULT '0',
  `
Division` int(10) DEFAULT '0',
  `
FMember` int(10) DEFAULT '0',
  `
SpeakerPhone` int(10) DEFAULT '0',
  `
Rank` int(10) DEFAULT '0',
  `
WantedLevel` int(10) DEFAULT '0',
  `
Pot` int(10) DEFAULT '0',
  `
Crack` int(10) DEFAULT '0',
  `
Helper` int(10) DEFAULT '0',
  `
Health` float NOT NULL DEFAULT '100',
  `
Armor` float NOT NULL DEFAULT '50',
  `
Interior` int(10) DEFAULT '0',
  `
Local` int(10) DEFAULT '0',
  `
Team` int(10) DEFAULT '0',
  `
Pnumber` int(10) DEFAULT '0',
  `
Posx` float NOT NULL DEFAULT '1685.68',
  `
Posy` float NOT NULL DEFAULT '-2334.56',
  `
Posz` float NOT NULL DEFAULT '-2.6797',
  `
Posr` float NOT NULL DEFAULT '350.866',
  `
CarLic` int(10) DEFAULT '0',
  `
FlyLic` int(10) DEFAULT '0',
  `
BoatLic` int(10) DEFAULT '0',
  `
FishLic` int(10) DEFAULT '0',
  `
GunLic` int(10) DEFAULT '0',
  `
CDPlayer` int(10) DEFAULT '0',
  `
Wins` int(10) DEFAULT '0',
  `
Loses` int(10) DEFAULT '0',
  `
Tut` int(10) DEFAULT '0',
  `
Warns` int(10) DEFAULT '0',
  `
Married` int(10) DEFAULT '0',
  `
C4` int(10) DEFAULT '0',
  `
C4Get` int(10) DEFAULT '0',
  `
C4Used` int(10) DEFAULT '0',
  `
MarriedTo` varchar(128) NOT NULL DEFAULT '0',
  `
Sprunk` int(10) DEFAULT '0',
  `
Cigar` int(10) DEFAULT '0',
  `
Pole` int(10) DEFAULT '0',
  `
Spraycan` int(10) DEFAULT '0',
  `
Rope` int(10) DEFAULT '0',
  `
Dice` int(10) DEFAULT '0',
  `
Bombs` int(10) DEFAULT '0',
  `
Duty` int(10) DEFAULT '0',
  `
FightStyle` int(10) DEFAULT '0',
  `
Banned` int(10) DEFAULT '0',
  `
PermaBanned` int(10) DEFAULT '0',
  `
Disabled` int(10) DEFAULT '0',
  `
Accent` int(10) DEFAULT '0',
  `
CHits` int(10) DEFAULT '0',
  `
FHits` int(10) DEFAULT '0',
  `
Crates` int(10) DEFAULT '0',
  `
VW` int(10) DEFAULT '0',
  `
Clothes` int(10) DEFAULT '0',
  `
TempVIP` int(10) DEFAULT '0',
  `
Tokens` int(10) DEFAULT '0',
  `
DrugsTime` int(10) DEFAULT '0',
  `
LawyerTime` int(10) DEFAULT '0',
  `
GangWarn` int(10) DEFAULT '0',
  `
FactionBanned` int(10) DEFAULT '0',
  `
MechTime` int(10) DEFAULT '0',
  `
SexTime` int(10) DEFAULT '0',
  `
LawyerFreeTime` int(10) DEFAULT '0',
  `
ContractBy` varchar(32) NOT NULL DEFAULT '0',
  `
ContractDetail` varchar(64) NOT NULL DEFAULT '0',
  `
BanAppealer` int(10) DEFAULT '0',
  `
Undercover` int(10) DEFAULT '0',
  `
TogReports` int(10) DEFAULT '0',
  `
Radio` int(10) DEFAULT '0',
  `
RadioFreq` int(10) DEFAULT '0',
  `
DutyHours` int(10) DEFAULT '0',
  `
AcceptedHelp` int(10) DEFAULT '0',
  `
AcceptReport` int(10) DEFAULT '0',
  `
TrashReport` int(10) DEFAULT '0',
  `
TriageTime` int(10) DEFAULT '0',
  `
TaxiLicense` int(10) DEFAULT '0',
  `
TicketTime` int(10) DEFAULT '0',
  `
Wristwatch` int(10) DEFAULT '0',
  `
Surveillance` int(10) DEFAULT '0',
  `
Tire` int(10) DEFAULT '0',
  `
Firstaid` int(10) DEFAULT '0',
  `
Rccam` int(10) DEFAULT '0',
  `
Receiver` int(10) DEFAULT '0',
  `
GPS` int(10) DEFAULT '0',
  `
Sweep` int(10) DEFAULT '0',
  `
SweepLeft` int(10) DEFAULT '0',
  `
Bugged` int(10) DEFAULT '0',
  `
CallsAccepted` int(10) DEFAULT '0',
  `
LiveBanned` int(10) DEFAULT '0',
  `
ServiceTime` int(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)