SA-MP Forums Archive
sscanf enum - 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: sscanf enum (/showthread.php?tid=178653)



sscanf enum - vection - 23.09.2010

pawn Код:
enum pInfo
{
    pNick[128],
    pKey[128],
    pLevel,
    pAdmin,
    pDonateRank,
    gPupgrade,
    pConnectTime,
    pReg,
    pSex,
    pAge,
    pBan,
    pReason[128],
    pOrigin,
    pCK,
    pMuted,
    pExp,
    pCash,
    pAccount,
    pCrimes,
    pKills,
    pDeaths,
    pArrested,
    pWantedDeaths,
    pPhoneBook,
    pLottoNr,
    pFishes,
    pBiggestFish,
    pJob,
    pPayCheck,
    pHeadValue,
    pJailed,
    pJailTime,
    pJailday,
    pJailmonth,
    pJailyear,
    pJailar,
    pMats,
    pDrugs,
    pLeader,
    pMember,
    pFMember,
    pRank,
    pChar,
    pContractTime,
    pDetSkill,
    pSexSkill,
    pBoxSkill,
    pLawSkill,
    pMechSkill,
    pJackSkill,
    pCarSkill,
    pNewsSkill,
    pDrugsSkill,
    pCookSkill,
    pFishSkill,
    Float:pHealth,
    Float:pSHealth,
    pInt,
    pLocal,
    pTeam,
    pModel,
    pPnumber,
    pVkey,
    pVkey2,
    pVkey3,
    pVkey4,
    pVkey5,
    pGkey,
    pGkey2,
    pGkey3,
    pGkey4,
    pGkey5,
    pPhousekey,
    pPbiskey,
    pCarKey,
    pJobpay,
    pBill,
    pUrank,
    pCar,
    pName[128],
    pName2[128],
    pName3[128],
    pName4[128],
    pName5[128],
    Float:pPos_x,
    Float:pPos_y,
    Float:pPos_z,
    Float:pPos_a,
    pDlicense,
    pBlicense,
    pWlicense,
    pFlicense,
    pSlicense,
    pFSlicense,
    pPrem,
    pCarLic,
    pFlyLic,
    pBoatLic,
    pFishLic,
    pGunLic,
    pGun1,
    pGun2,
    pGun3,
    pGun4,
    pAmmo1,
    pAmmo2,
    pAmmo3,
    pAmmo4,
    pTrunkGun1,
    pTrunkGun2,
    pTrunkGun3,
    pTrunkGun4,
    pTrunkGun5,
    pTrunkAmmo1,
    pTrunkAmmo2,
    pTrunkAmmo3,
    pTrunkAmmo4,
    pTrunkAmmo5,
    pParkcar,
    pParkcar2,
    pParkcar3,
    pParkcar4,
    pParkcar5,
    pCarTime,
    pPayDay,
    pPayDayHad,
    pCDPlayer,
    pWins,
    pLoses,
    pAlcoholPerk,
    pDrugPerk,
    pMiserPerk,
    pPainPerk,
    pTraderPerk,
    pTut,
    pWarns,
    pAdjustable,
    pFuel,
    pKeyCar,
    pOver,
    Float:pvehiclex4,
    Float:pvehicley4,
    Float:pvehiclez4,
    Float:pvehiclea4,
    pvehiclem4,
    pPass1[128],
    pPass2[128],
    pPass3[128],
    pPass4[128],
    pPass5[128],
    pLevelLock1,
    pLevelLock2,
    pLevelLock3,
    pLevelLock4,
    pLevelLock5,
    pLevelimmob1,
    pLevelimmob2,
    pLevelimmob3,
    pLevelimmob4,
    pLevelimmob5,
    pLevelalarm1,
    pLevelalarm2,
    pLevelalarm3,
    pLevelalarm4,
    pLevelalarm5,
    pInsurance1,
    pInsurance2,
    pInsurance3,
    pInsurance4,
    pInsurance5,
    pPrimp,
    Float:pvehiclex6,
    Float:pvehicley6,
    Float:pvehiclez6,
    Float:pvehiclea6,
    pvehiclem6,
    Float:pvehiclex5,
    Float:pvehicley5,
    Float:pvehiclez5,
    Float:pvehiclea5,
    pvehiclem5,
    pNumberv,
    Float:pvx,
    Float:pvy,
    Float:pvz,
    Float:pva,
    pvmodel1,
    Float:pvx3,
    Float:pvy3,
    Float:pvz3,
    Float:pva3,
    pvmodel3,
    Float:plx1,
    Float:ply1,
    Float:plz1,
    Float:plx2,
    Float:ply2,
    Float:plz2,
    Float:plx3,
    Float:ply3,
    Float:plz3,
    Float:plx4,
    Float:ply4,
    Float:plz4,
    Float:plx5,
    Float:ply5,
    Float:plz5,
    pMarried,
    pMarriedTo[128]
};
new PlayerInfo[MAX_PLAYERS][pInfo];
public LoadMYSQL(playerid, password[])
{
    new sscanfinput[64], string[256];
     new name[24],
      Escape[2][128];
     GetPlayerName(playerid, name, 50);
     mysql_real_escape_string(name, Escape[0]); // This function makes sure you don't get MySQL injected. Read about it by searching it on ******.
     mysql_real_escape_string(sscanfinput, Escape[1]);
     //format(string, 128, "SELECT * FROM `playerinfo` WHERE `user` = '%s' AND `password` = '%s'", name, password);
     format(string, sizeof(string), "SELECT * FROM `playerinfo` WHERE `user` = '%s' AND `password` = '%s'", name, password);
     mysql_query(string);
     mysql_store_result();
     SendClientMessage(playerid, COLOR_PURPLE, "You're logged in.");
     new row[2048];
     mysql_fetch_row_format(row, "|");
     new var2[pInfo];
     sscanf(row, "p<|>e<s[30]s[30]iiiiiiiiiiiis[30]iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis[30]s[30]s[30]s[30]s[30]iffffiffffiffffiiffffffffifffffffffffffffiiis[30]s[30]s[30]s[30]s[30]ffffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis[30]>", var2);
     printf("pNick: %s",PlayerInfo[playerid][pNick]);
     printf("pKey: %s",PlayerInfo[playerid][pKey]);
     printf("Level: %i",PlayerInfo[playerid][pLevel]);
     printf("Admin: %i",PlayerInfo[playerid][pAdmin]);
     mysql_store_result();
     mysql_free_result();
     gPlayerLogged[playerid] = 1;
     SendClientMessage(playerid, COLOR_YELLOW, "Account loaded.");
     return 1;
}
The code is stuck at var2[pInfo].. if i change it to PlayerInfo[playerid]
its load only the first on‌e = pNIck.


Re: sscanf enum - vection - 23.09.2010

upppppppppppppppppp


Re: sscanf enum - CAR - 23.09.2010

I really don't know if this is working...
pawn Код:
new sizevar2 = sizeof(pInfo);
new var2[sizevar2];
var2 = pInfo;
I just don't think it's working, but try it


Re: sscanf enum - vection - 23.09.2010

Quote:
Originally Posted by CAR
Посмотреть сообщение
I really don't know if this is working...
pawn Код:
new sizevar2 = sizeof(pInfo);
new var2[sizevar2];
var2 = pInfo;
I just don't think it's working, but try it
Too much errors:
pawn Код:
(6369) : error 039: constant symbol has no size
(6370) : error 008: must be a constant expression; assumed zero
6370) : error 009: invalid array size (negative, zero or out of bounds)
(6370) : error 036: empty statement
(6370) : fatal error 107: too many error messages on one line



Re: sscanf enum - bigcomfycouch - 23.09.2010

You're overloading strings by defining them at a certain length ( 128 ), but in sscanf you're defining their max length as 30.


Re: sscanf enum - vection - 24.09.2010

So how i can load it ?


Re: sscanf enum - Cameltoe - 24.09.2010

Iv'e made an thread about this .. Just a sec

EDIT: https://sampforum.blast.hk/showthread.php?tid=177139

Anyway: s[30]s[30] should be s[128]s[128] i guess


Re: sscanf enum - vection - 24.09.2010

Quote:
Originally Posted by Cameltoe
Посмотреть сообщение
Iv'e made an thread about this .. Just a sec

EDIT: https://sampforum.blast.hk/showthread.php?tid=177139

Anyway: s[30]s[30] should be s[128]s[128] i guess
I just copy past this code and its not working.


Re: sscanf enum - Cameltoe - 24.09.2010

pNick[128],
pKey[128],

Both containing 128 chars.. means the sscanf needs and input like this: s[128]s[128]


Re: sscanf enum - Cameltoe - 24.09.2010

pNick[128],
pKey[128],

Both containing 128 chars.. means the sscanf needs and input like this: s[128]s[128]

Nice double posting..