[MYSQL] Explode
#1

pawn Код:
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[1024];
     new ExplodeSplit[210][128];
     new MyAdminLevel;
     new MyUserName[64];
     mysql_fetch_row_format(row, "|");
     explode(ExplodeSplit, row, "|");
     mysql_free_result();
     SendClientMessage(playerid, COLOR_PURPLE, "Account Begins to load..");
     strmid(MyUserName, ExplodeSplit[0], 0, strlen(ExplodeSplit[0]), 255); // https://sampwiki.blast.hk/wiki/Strmid
     strmid(PlayerInfo[playerid][pKey], ExplodeSplit[1], 0, strlen(ExplodeSplit[1]), 255);
     PlayerInfo[playerid][pLevel] = strval(ExplodeSplit[2]);
     PlayerInfo[playerid][pAdmin] = strval(ExplodeSplit[3]);
     PlayerInfo[playerid][pDonateRank] = strval(ExplodeSplit[4]);
     PlayerInfo[playerid][gPupgrade] = strval(ExplodeSplit[5]);
     PlayerInfo[playerid][pConnectTime] = strval(ExplodeSplit[6]);
     PlayerInfo[playerid][pReg] = strval(ExplodeSplit[7]);
     PlayerInfo[playerid][pSex] = strval(ExplodeSplit[8]);
     PlayerInfo[playerid][pAge] = strval(ExplodeSplit[9]);
     PlayerInfo[playerid][pOrigin] = strval(ExplodeSplit[10]);
     PlayerInfo[playerid][pCK] = strval(ExplodeSplit[11]);
     PlayerInfo[playerid][pMuted] = strval(ExplodeSplit[12]);
     PlayerInfo[playerid][pExp] = strval(ExplodeSplit[13]);
     PlayerInfo[playerid][pCash] = strval(ExplodeSplit[14]);
     PlayerInfo[playerid][pAccount] = strval(ExplodeSplit[15]);
     PlayerInfo[playerid][pCrimes] = strval(ExplodeSplit[16]);
     PlayerInfo[playerid][pKills] = strval(ExplodeSplit[17]);
     PlayerInfo[playerid][pBan] = strval(ExplodeSplit[18]);
     strmid(PlayerInfo[playerid][pReason], ExplodeSplit[19], 0, strlen(ExplodeSplit[19]), 255);
     PlayerInfo[playerid][pDeaths] = strval(ExplodeSplit[20]);
     PlayerInfo[playerid][pArrested] = strval(ExplodeSplit[21]);
     PlayerInfo[playerid][pWantedDeaths] = strval(ExplodeSplit[22]);
     PlayerInfo[playerid][pPhoneBook] = strval(ExplodeSplit[23]);
     PlayerInfo[playerid][pLottoNr] = strval(ExplodeSplit[24]);
     PlayerInfo[playerid][pFishes] = strval(ExplodeSplit[25]);
     PlayerInfo[playerid][pBiggestFish] = strval(ExplodeSplit[26]);
     PlayerInfo[playerid][pJob] = strval(ExplodeSplit[27]);
     PlayerInfo[playerid][pPayCheck] = strval(ExplodeSplit[28]);
     PlayerInfo[playerid][pHeadValue] = strval(ExplodeSplit[29]);
     PlayerInfo[playerid][pJailed] = strval(ExplodeSplit[30]);
     PlayerInfo[playerid][pJailTime] = strval(ExplodeSplit[31]);
     PlayerInfo[playerid][pJailday] = strval(ExplodeSplit[32]);
     PlayerInfo[playerid][pJailmonth] = strval(ExplodeSplit[33]);
     PlayerInfo[playerid][pJailyear] = strval(ExplodeSplit[34]);
     PlayerInfo[playerid][pJailar] = strval(ExplodeSplit[35]);
     PlayerInfo[playerid][pMats] = strval(ExplodeSplit[36]);
     PlayerInfo[playerid][pDrugs] = strval(ExplodeSplit[37]);
     PlayerInfo[playerid][pLeader] = strval(ExplodeSplit[38]);
     PlayerInfo[playerid][pMember] = strval(ExplodeSplit[39]);
     PlayerInfo[playerid][pFMember] = strval(ExplodeSplit[40]);
     PlayerInfo[playerid][pRank] = strval(ExplodeSplit[41]);
     PlayerInfo[playerid][pChar] = strval(ExplodeSplit[42]);
     PlayerInfo[playerid][pContractTime] = strval(ExplodeSplit[43]);
     PlayerInfo[playerid][pDetSkill] = strval(ExplodeSplit[44]);
     PlayerInfo[playerid][pSexSkill] = strval(ExplodeSplit[45]);
     PlayerInfo[playerid][pBoxSkill] = strval(ExplodeSplit[46]);
     PlayerInfo[playerid][pLawSkill] = strval(ExplodeSplit[47]);
     PlayerInfo[playerid][pMechSkill] = strval(ExplodeSplit[48]);
     PlayerInfo[playerid][pJackSkill] = strval(ExplodeSplit[49]);
     PlayerInfo[playerid][pCarSkill] = strval(ExplodeSplit[50]);
     PlayerInfo[playerid][pNewsSkill] = strval(ExplodeSplit[51]);
     PlayerInfo[playerid][pDrugsSkill] = strval(ExplodeSplit[52]);
     PlayerInfo[playerid][pCookSkill] = strval(ExplodeSplit[53]);
     PlayerInfo[playerid][pFishSkill] = strval(ExplodeSplit[54]);
     PlayerInfo[playerid][pSHealth] = floatstr(ExplodeSplit[55]);
     PlayerInfo[playerid][pHealth] = floatstr(ExplodeSplit[56]);
     PlayerInfo[playerid][pInt] = strval(ExplodeSplit[57]);
     PlayerInfo[playerid][pLocal] = strval(ExplodeSplit[58]);
     PlayerInfo[playerid][pTeam] = strval(ExplodeSplit[59]);
     PlayerInfo[playerid][pModel] = strval(ExplodeSplit[60]);
     PlayerInfo[playerid][pPnumber] = strval(ExplodeSplit[61]);
     PlayerInfo[playerid][pVkey] = strval(ExplodeSplit[62]);
     PlayerInfo[playerid][pVkey2] = strval(ExplodeSplit[63]);
     PlayerInfo[playerid][pVkey3] = strval(ExplodeSplit[64]);
     PlayerInfo[playerid][pVkey4] = strval(ExplodeSplit[65]);
     PlayerInfo[playerid][pVkey5] = strval(ExplodeSplit[66]);
     PlayerInfo[playerid][pGkey] = strval(ExplodeSplit[67]);
     PlayerInfo[playerid][pGkey2] = strval(ExplodeSplit[68]);
     PlayerInfo[playerid][pGkey3] = strval(ExplodeSplit[69]);
     PlayerInfo[playerid][pGkey4] = strval(ExplodeSplit[70]);
     PlayerInfo[playerid][pGkey5] = strval(ExplodeSplit[71]);
     PlayerInfo[playerid][pPhousekey] = strval(ExplodeSplit[72]);
     PlayerInfo[playerid][pPbiskey] = strval(ExplodeSplit[73]);
     PlayerInfo[playerid][pCarKey] = strval(ExplodeSplit[74]);
     PlayerInfo[playerid][pKeyCar] = strval(ExplodeSplit[75]);
     PlayerInfo[playerid][pOver] = strval(ExplodeSplit[76]);
     PlayerInfo[playerid][pLevelLock1] = strval(ExplodeSplit[77]);
     PlayerInfo[playerid][pLevelLock2] = strval(ExplodeSplit[78]);
     PlayerInfo[playerid][pLevelLock3] = strval(ExplodeSplit[79]);
     PlayerInfo[playerid][pLevelLock4] = strval(ExplodeSplit[80]);
     PlayerInfo[playerid][pLevelLock5] = strval(ExplodeSplit[81]);
     PlayerInfo[playerid][pLevelimmob1] = strval(ExplodeSplit[82]);
     PlayerInfo[playerid][pLevelimmob2] = strval(ExplodeSplit[83]);
     PlayerInfo[playerid][pLevelimmob3] = strval(ExplodeSplit[84]);
     PlayerInfo[playerid][pLevelimmob4] = strval(ExplodeSplit[85]);
     PlayerInfo[playerid][pLevelimmob5] = strval(ExplodeSplit[86]);
     PlayerInfo[playerid][pLevelalarm1] = strval(ExplodeSplit[87]);
     PlayerInfo[playerid][pLevelalarm2] = strval(ExplodeSplit[88]);
     PlayerInfo[playerid][pLevelalarm3] = strval(ExplodeSplit[89]);
     PlayerInfo[playerid][pLevelalarm4] = strval(ExplodeSplit[90]);
     PlayerInfo[playerid][pLevelalarm5] = strval(ExplodeSplit[91]);
     PlayerInfo[playerid][pInsurance1] = strval(ExplodeSplit[92]);
     PlayerInfo[playerid][pInsurance2] = strval(ExplodeSplit[93]);
     PlayerInfo[playerid][pInsurance3] = strval(ExplodeSplit[94]);
     PlayerInfo[playerid][pInsurance4] = strval(ExplodeSplit[95]);
     PlayerInfo[playerid][pInsurance5] = strval(ExplodeSplit[96]);
     PlayerInfo[playerid][pPrimp] = strval(ExplodeSplit[97]);
     strmid(PlayerInfo[playerid][pPass1], ExplodeSplit[98], 0, strlen(ExplodeSplit[98]), 255);
     strmid(PlayerInfo[playerid][pPass2], ExplodeSplit[99], 0, strlen(ExplodeSplit[99]), 255);
     strmid(PlayerInfo[playerid][pPass3], ExplodeSplit[100], 0, strlen(ExplodeSplit[100]), 255);
     strmid(PlayerInfo[playerid][pPass4], ExplodeSplit[101], 0, strlen(ExplodeSplit[101]), 255);
     strmid(PlayerInfo[playerid][pPass5], ExplodeSplit[102], 0, strlen(ExplodeSplit[102]), 255);
     PlayerInfo[playerid][pvehiclem4] = strval(ExplodeSplit[103]);
     PlayerInfo[playerid][pvehiclex4] = floatstr(ExplodeSplit[104]);
     PlayerInfo[playerid][pvehicley4] = floatstr(ExplodeSplit[105]);
     PlayerInfo[playerid][pvehiclez4] = floatstr(ExplodeSplit[106]);
     PlayerInfo[playerid][pvehiclea4] = floatstr(ExplodeSplit[107]);
     PlayerInfo[playerid][pvehiclem6] = strval(ExplodeSplit[108]);
     PlayerInfo[playerid][pvehiclex6] = floatstr(ExplodeSplit[109]);
     PlayerInfo[playerid][pvehicley6] = floatstr(ExplodeSplit[110]);
     PlayerInfo[playerid][pvehiclez6] = floatstr(ExplodeSplit[111]);
     PlayerInfo[playerid][pvehiclea6] = floatstr(ExplodeSplit[112]);
     PlayerInfo[playerid][pvehiclem5] = strval(ExplodeSplit[113]);
     PlayerInfo[playerid][pvehiclex5] = floatstr(ExplodeSplit[114]);
     PlayerInfo[playerid][pvehicley5] = floatstr(ExplodeSplit[115]);
     PlayerInfo[playerid][pvehiclez5] = floatstr(ExplodeSplit[116]);
     PlayerInfo[playerid][pvehiclea5] = floatstr(ExplodeSplit[117]);
     PlayerInfo[playerid][pvmodel1] = strval(ExplodeSplit[118]);
     PlayerInfo[playerid][pNumberv] = strval(ExplodeSplit[119]);
     PlayerInfo[playerid][pvx] = floatstr(ExplodeSplit[120]);
     PlayerInfo[playerid][pvy] = floatstr(ExplodeSplit[121]);
     PlayerInfo[playerid][pvz] = floatstr(ExplodeSplit[122]);
     PlayerInfo[playerid][pva] = floatstr(ExplodeSplit[123]);
     PlayerInfo[playerid][pvx3] = floatstr(ExplodeSplit[124]);
     PlayerInfo[playerid][pvy3] = floatstr(ExplodeSplit[125]);
     PlayerInfo[playerid][pvz3] = floatstr(ExplodeSplit[126]);
     PlayerInfo[playerid][pva3] = floatstr(ExplodeSplit[127]);
     PlayerInfo[playerid][pvmodel3] = strval(ExplodeSplit[128]);
     PlayerInfo[playerid][plx1] = floatstr(ExplodeSplit[129]);
     PlayerInfo[playerid][ply1] = floatstr(ExplodeSplit[130]);
     PlayerInfo[playerid][plz1] = floatstr(ExplodeSplit[131]);
     PlayerInfo[playerid][plx2] = floatstr(ExplodeSplit[132]);
     PlayerInfo[playerid][ply2] = floatstr(ExplodeSplit[133]);
     PlayerInfo[playerid][plz2] = floatstr(ExplodeSplit[134]);
     PlayerInfo[playerid][plx3] = floatstr(ExplodeSplit[135]);
     PlayerInfo[playerid][ply3] = floatstr(ExplodeSplit[136]);
     PlayerInfo[playerid][plz3] = floatstr(ExplodeSplit[137]);
     PlayerInfo[playerid][plx4] = floatstr(ExplodeSplit[138]);
     PlayerInfo[playerid][ply4] = floatstr(ExplodeSplit[139]);
     PlayerInfo[playerid][plz4] = floatstr(ExplodeSplit[140]);
     PlayerInfo[playerid][plx5] = floatstr(ExplodeSplit[141]);
     PlayerInfo[playerid][ply5] = floatstr(ExplodeSplit[142]);
     PlayerInfo[playerid][plz5] = floatstr(ExplodeSplit[143]);
     PlayerInfo[playerid][pJobpay] = strval(ExplodeSplit[144]);
     PlayerInfo[playerid][pBill] = strval(ExplodeSplit[145]);
     PlayerInfo[playerid][pUrank] = strval(ExplodeSplit[146]);
     PlayerInfo[playerid][pCar] = strval(ExplodeSplit[147]);
     strmid(PlayerInfo[playerid][pName], ExplodeSplit[148], 0, strlen(ExplodeSplit[148]), 255);
     strmid(PlayerInfo[playerid][pName2], ExplodeSplit[149], 0, strlen(ExplodeSplit[149]), 255);
     strmid(PlayerInfo[playerid][pName3], ExplodeSplit[150], 0, strlen(ExplodeSplit[150]), 255);
     strmid(PlayerInfo[playerid][pName4], ExplodeSplit[151], 0, strlen(ExplodeSplit[151]), 255);
     strmid(PlayerInfo[playerid][pName5], ExplodeSplit[152], 0, strlen(ExplodeSplit[152]), 255);
     PlayerInfo[playerid][pPos_x] = floatstr(ExplodeSplit[153]);
     PlayerInfo[playerid][pPos_y] = floatstr(ExplodeSplit[154]);
     printf("Load 150");
     PlayerInfo[playerid][pPos_z] = floatstr(ExplodeSplit[155]);
     PlayerInfo[playerid][pPos_a] = floatstr(ExplodeSplit[156]);
     PlayerInfo[playerid][pDlicense] = strval(ExplodeSplit[157]);
     PlayerInfo[playerid][pBlicense] = strval(ExplodeSplit[158]);
     PlayerInfo[playerid][pWlicense] = strval(ExplodeSplit[159]);
     PlayerInfo[playerid][pFlicense] = strval(ExplodeSplit[160]);
     PlayerInfo[playerid][pSlicense] = strval(ExplodeSplit[161]);
     PlayerInfo[playerid][pFSlicense] = strval(ExplodeSplit[162]);
     PlayerInfo[playerid][pPrem] = strval(ExplodeSplit[163]);
     PlayerInfo[playerid][pCarLic] = strval(ExplodeSplit[164]);
     PlayerInfo[playerid][pFlyLic] = strval(ExplodeSplit[165]);
     PlayerInfo[playerid][pBoatLic] = strval(ExplodeSplit[166]);
     PlayerInfo[playerid][pFishLic] = strval(ExplodeSplit[167]);
     PlayerInfo[playerid][pGunLic] = strval(ExplodeSplit[168]);
     PlayerInfo[playerid][pGun1] = strval(ExplodeSplit[169]);
     PlayerInfo[playerid][pGun2] = strval(ExplodeSplit[170]);
     PlayerInfo[playerid][pGun3] = strval(ExplodeSplit[171]);
     PlayerInfo[playerid][pGun4] = strval(ExplodeSplit[172]);
     PlayerInfo[playerid][pAmmo1] = strval(ExplodeSplit[173]);
     PlayerInfo[playerid][pAmmo2] = strval(ExplodeSplit[174]);
     PlayerInfo[playerid][pAmmo3] = strval(ExplodeSplit[175]);
     PlayerInfo[playerid][pAmmo4] = strval(ExplodeSplit[176]);
     PlayerInfo[playerid][pTrunkGun1] = strval(ExplodeSplit[177]);
     PlayerInfo[playerid][pTrunkGun2] = strval(ExplodeSplit[178]);
     PlayerInfo[playerid][pTrunkGun3] = strval(ExplodeSplit[179]);
     PlayerInfo[playerid][pTrunkGun4] = strval(ExplodeSplit[180]);
     PlayerInfo[playerid][pTrunkGun5] = strval(ExplodeSplit[181]);
     PlayerInfo[playerid][pTrunkAmmo1] = strval(ExplodeSplit[182]);
     PlayerInfo[playerid][pTrunkAmmo2] = strval(ExplodeSplit[183]);
     PlayerInfo[playerid][pTrunkAmmo3] = strval(ExplodeSplit[184]);
     PlayerInfo[playerid][pTrunkAmmo4] = strval(ExplodeSplit[185]);
     PlayerInfo[playerid][pTrunkAmmo5] = strval(ExplodeSplit[186]);
     PlayerInfo[playerid][pParkcar] = strval(ExplodeSplit[187]);
     PlayerInfo[playerid][pParkcar2] = strval(ExplodeSplit[188]);
     PlayerInfo[playerid][pParkcar3] = strval(ExplodeSplit[189]);
     PlayerInfo[playerid][pParkcar4] = strval(ExplodeSplit[190]);
     PlayerInfo[playerid][pParkcar5] = strval(ExplodeSplit[191]);
     PlayerInfo[playerid][pCarTime] = strval(ExplodeSplit[192]);
     PlayerInfo[playerid][pPayDay] = strval(ExplodeSplit[193]);
     PlayerInfo[playerid][pPayDayHad] = strval(ExplodeSplit[194]);
     PlayerInfo[playerid][pCDPlayer] = strval(ExplodeSplit[195]);
     PlayerInfo[playerid][pWins] = strval(ExplodeSplit[196]);
     PlayerInfo[playerid][pLoses] = strval(ExplodeSplit[197]);
     PlayerInfo[playerid][pAlcoholPerk] = strval(ExplodeSplit[198]);
     PlayerInfo[playerid][pDrugPerk] = strval(ExplodeSplit[199]);
     PlayerInfo[playerid][pMiserPerk] = strval(ExplodeSplit[200]);
     PlayerInfo[playerid][pPainPerk] = strval(ExplodeSplit[201]);
     PlayerInfo[playerid][pTraderPerk] = strval(ExplodeSplit[202]);
     PlayerInfo[playerid][pTut] = strval(ExplodeSplit[203]);
     PlayerInfo[playerid][pWarns] = strval(ExplodeSplit[204]);
     PlayerInfo[playerid][pAdjustable] = strval(ExplodeSplit[205]);
     PlayerInfo[playerid][pFuel] = strval(ExplodeSplit[206]);
     PlayerInfo[playerid][pMarried] = strval(ExplodeSplit[207]);
     strmid(PlayerInfo[playerid][pMarriedTo], ExplodeSplit[208], 0, strlen(ExplodeSplit[208]), 255);
     mysql_store_result();
     mysql_free_result();
     gPlayerLogged[playerid] = 1;
     SendClientMessage(playerid, COLOR_YELLOW, "Account loaded.");
     return 1;
}
This code isnt loading well.
Actually, The script stop in ExplodeSplit. For example, if i change the ExplodeSplit to [210][1] is loading, but only one note. And if i stay it like that its just stop right there.
Any way to split it or i dont know.. somthing to fix it.
[And dont tell me to use sscanf because its not working..]
Reply
#2

UPpppppppppppppppp
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)