strtok > Sscanf
#5

Assuming that you're storing all the data from the MySQL player table into a string, and that string is "Data",
the correct sscanf(2) syntax would look like this:
pawn Код:
// your query code
        // storing the result set..
        mysql_store_result();
       
        sscanf(Data, "p<|>dddddddddddddddddddddddddddddddddddddddddddddddfffdddddddddddddddddddddddddddddds[24]dddddddds[16]s[16]d",
        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][pOrigin],
        PlayerInfo[playerid][pCK],
        PlayerInfo[playerid][pMuted],
        PlayerInfo[playerid][pExp],
        PlayerInfo[playerid][pCash],
        PlayerInfo[playerid][pAccount],
        PlayerInfo[playerid][pCrimes],
        PlayerInfo[playerid][pKills],
        PlayerInfo[playerid][pDeaths],
        PlayerInfo[playerid][pArrested],
        PlayerInfo[playerid][pWantedDeaths],
        PlayerInfo[playerid][pPhoneBook],
        PlayerInfo[playerid][pLottoNr],
        PlayerInfo[playerid][pFishes],
        PlayerInfo[playerid][pBiggestFish],
        PlayerInfo[playerid][pJob],
        PlayerInfo[playerid][pPayCheck],
        PlayerInfo[playerid][pHeadValue],
        PlayerInfo[playerid][pJailed],
        PlayerInfo[playerid][pJailTime],
        PlayerInfo[playerid][pMats],
        PlayerInfo[playerid][pDrugs],
        PlayerInfo[playerid][pLeader],
        PlayerInfo[playerid][pMember],
        PlayerInfo[playerid][pFMember],
        PlayerInfo[playerid][pRank],
        PlayerInfo[playerid][pChar],
        PlayerInfo[playerid][pContractTime],
        PlayerInfo[playerid][pDetSkill],
        PlayerInfo[playerid][pSexSkill],
        PlayerInfo[playerid][pBoxSkill],
        PlayerInfo[playerid][pLawSkill],
        PlayerInfo[playerid][pMechSkill],
        PlayerInfo[playerid][pJackSkill],
        PlayerInfo[playerid][pCarSkill],
        PlayerInfo[playerid][pNewsSkill],
        PlayerInfo[playerid][pDrugsSkill],
        PlayerInfo[playerid][pCookSkill],
        PlayerInfo[playerid][pFishSkill],
        PlayerInfo[playerid][pSHealth],
        PlayerInfo[playerid][pHealth],
        PlayerInfo[playerid][pInt],
        PlayerInfo[playerid][pLocal],
        PlayerInfo[playerid][pTeam],
        PlayerInfo[playerid][pModel],
        PlayerInfo[playerid][pPnumber],
        PlayerInfo[playerid][pPhousekey],
        PlayerInfo[playerid][pPcarkey],
        PlayerInfo[playerid][pPapptkey],
        PlayerInfo[playerid][pPbiskey],
        PlayerInfo[playerid][pPos_x],
        PlayerInfo[playerid][pPos_z],
        PlayerInfo[playerid][pPos_y],
        PlayerInfo[playerid][pCarLic],
        PlayerInfo[playerid][pFlyLic],
        PlayerInfo[playerid][pBoatLic],
        PlayerInfo[playerid][pFishLic],
        PlayerInfo[playerid][pGunLic],
        PlayerInfo[playerid][pGun1],
        PlayerInfo[playerid][pGun2],
        PlayerInfo[playerid][pGun3],
        PlayerInfo[playerid][pGun4],
        PlayerInfo[playerid][pAmmo1],
        PlayerInfo[playerid][pAmmo2],
        PlayerInfo[playerid][pAmmo3],
        PlayerInfo[playerid][pAmmo4],
        PlayerInfo[playerid][pCarTime],
        PlayerInfo[playerid][pPayDay],
        PlayerInfo[playerid][pPayDayHad],
        PlayerInfo[playerid][pCDPlayer],
        PlayerInfo[playerid][pWins],
        PlayerInfo[playerid][pLoses],
        PlayerInfo[playerid][pAlcoholPerk],
        PlayerInfo[playerid][pDrugPerk],
        PlayerInfo[playerid][pMiserPerk],
        PlayerInfo[playerid][pPainPerk],
        PlayerInfo[playerid][pTraderPerk],
        PlayerInfo[playerid][pTut],
        PlayerInfo[playerid][pMissionNr],
        PlayerInfo[playerid][pWarns],
        PlayerInfo[playerid][pAdjustable],
        PlayerInfo[playerid][pFuel],
        PlayerInfo[playerid][pMarried],
        PlayerInfo[playerid][pMarriedTo],
        PlayerInfo[playerid][pLinked],
        PlayerInfo[playerid][pDeagle],
        PlayerInfo[playerid][pShotgun],
        PlayerInfo[playerid][pRifle],
        PlayerInfo[playerid][pSDPistol],
        PlayerInfo[playerid][pMP5],
        PlayerInfo[playerid][pM4],
        PlayerInfo[playerid][pAK47],
        PlayerInfo[playerid][pStartIP],
        PlayerInfo[playerid][pEndIP],
        PlayerInfo[playerid][pLocker]);
Also if you can give me some rep on this since it really took a while to convert all of this to sscanf2!
Edit: Aso, for your reference, if you don't understand what does all that loong code after "sscanf(Data," do, have a look at the original sscanf2 topic !
Reply


Messages In This Thread
strtok > Sscanf - by wouter0100 - 30.08.2011, 10:55
Re: strtok > Sscanf - by =WoR=G4M3Ov3r - 30.08.2011, 11:16
Re: strtok > Sscanf - by wouter0100 - 30.08.2011, 11:21
Re: strtok > Sscanf - by wouter0100 - 30.08.2011, 12:30
Re: strtok > Sscanf - by Virtual1ty - 30.08.2011, 13:00

Forum Jump:


Users browsing this thread: 3 Guest(s)