Functie LoginMySQL(playerid, Nume[], Parola[])
{
new Query[255];
new SqLNickName[MAX_PLAYER_NAME],SqLKey[128];
mysql_real_escape_string(Nume, SqLNickName);
mysql_real_escape_string(Parola, SqLKey);
format(Query, sizeof(Query), "SELECT * FROM playeri WHERE Nume = '%s' AND Parola = '%s'", SqLNickName, SqLKey);
mysql_function_query(ConexiuneMySQL, Query , true, "LoginMySQL2", "i", playerid);
return 1;
}
Functie LoginMySQL2(playerid)
{
new string[255];
new rows, fields;
cache_get_data(rows, fields);
if(rows)
{
cache_get_row(0, 0, string); strmid(PlayerInfo[playerid][pNickName], string, 0, strlen(string), MAX_PLAYER_NAME);
cache_get_row(0, 1, string); strmid(PlayerInfo[playerid][pKey], string, 0, strlen(string), 128);
cache_get_row(0, 2, string); PlayerInfo[playerid][pLevel] = strval(string);
cache_get_row(0, 3, string); PlayerInfo[playerid][pAdmin] = strval(string);
cache_get_row(0, 4, string); PlayerInfo[playerid][pHelper] = strval(string);
cache_get_row(0, 5, string); PlayerInfo[playerid][pDonateRank] = strval(string);
cache_get_row(0, 6, string); PlayerInfo[playerid][gPupgrade] = strval(string);
cache_get_row(0, 7, string); PlayerInfo[playerid][pConnectTime] = strval(string);
cache_get_row(0, 8, string); PlayerInfo[playerid][pReg] = strval(string);
cache_get_row(0, 9, string); PlayerInfo[playerid][pSex] = strval(string);
cache_get_row(0, 10, string); PlayerInfo[playerid][pAge] = strval(string);
cache_get_row(0, 11, string); PlayerInfo[playerid][pOrigin] = strval(string);
cache_get_row(0, 12, string); PlayerInfo[playerid][pMuted] = strval(string);
cache_get_row(0, 13, string); PlayerInfo[playerid][pExp] = strval(string);
cache_get_row(0, 14, string); PlayerInfo[playerid][pCash] = strval(string);
cache_get_row(0, 15, string); PlayerInfo[playerid][pAccount] = strval(string);
cache_get_row(0, 16, string); PlayerInfo[playerid][pCrimes] = strval(string);
cache_get_row(0, 17, string); PlayerInfo[playerid][pKills] = strval(string);
cache_get_row(0, 18, string); PlayerInfo[playerid][pDeaths] = strval(string);
cache_get_row(0, 19, string); PlayerInfo[playerid][pArrested] = strval(string);
cache_get_row(0, 20, string); PlayerInfo[playerid][pWantedDeaths] = strval(string);
cache_get_row(0, 21, string); PlayerInfo[playerid][pPhoneBook] = strval(string);
cache_get_row(0, 22, string); PlayerInfo[playerid][pFishes] = strval(string);
cache_get_row(0, 23, string); PlayerInfo[playerid][pBiggestFish] = strval(string);
cache_get_row(0, 24, string); PlayerInfo[playerid][pJob] = strval(string);
cache_get_row(0, 25, string); PlayerInfo[playerid][pPayCheck] = strval(string);
cache_get_row(0, 26, string); PlayerInfo[playerid][pHeadValue] = strval(string);
cache_get_row(0, 27, string); PlayerInfo[playerid][pJailed] = strval(string);
cache_get_row(0, 28, string); PlayerInfo[playerid][pJailTime] = strval(string);
cache_get_row(0, 29, string); PlayerInfo[playerid][pMats] = strval(string);
cache_get_row(0, 30, string); PlayerInfo[playerid][pDrugs] = strval(string);
cache_get_row(0, 31, string); PlayerInfo[playerid][pLeader] = strval(string);
cache_get_row(0, 32, string); PlayerInfo[playerid][pMember] = strval(string);
cache_get_row(0, 33, string); PlayerInfo[playerid][pRank] = strval(string);
cache_get_row(0, 34, string); PlayerInfo[playerid][pChar] = strval(string);
cache_get_row(0, 35, string); PlayerInfo[playerid][pContractTime] = strval(string);
cache_get_row(0, 36, string); PlayerInfo[playerid][pDetSkill] = strval(string);
cache_get_row(0, 37, string); PlayerInfo[playerid][pSexSkill] = strval(string);
cache_get_row(0, 38, string); PlayerInfo[playerid][pLawSkill] = strval(string);
cache_get_row(0, 39, string); PlayerInfo[playerid][pMechSkill] = strval(string);
cache_get_row(0, 40, string); PlayerInfo[playerid][pJackSkill] = strval(string);
cache_get_row(0, 41, string); PlayerInfo[playerid][pCarSkill] = strval(string);
cache_get_row(0, 42, string); PlayerInfo[playerid][pNewsSkill] = strval(string);
cache_get_row(0, 43, string); PlayerInfo[playerid][pDrugsSkill] = strval(string);
cache_get_row(0, 44, string); PlayerInfo[playerid][pFishSkill] = strval(string);
cache_get_row(0, 45, string); PlayerInfo[playerid][pSHealth] = floatstr(string);
cache_get_row(0, 46, string); PlayerInfo[playerid][pHealth] = floatstr(string);
cache_get_row(0, 47, string); PlayerInfo[playerid][pInt] = strval(string);
cache_get_row(0, 48, string); PlayerInfo[playerid][pLocal] = strval(string);
cache_get_row(0, 49, string); PlayerInfo[playerid][pTeam] = strval(string);
cache_get_row(0, 50, string); PlayerInfo[playerid][pModel] = strval(string);
cache_get_row(0, 51, string); PlayerInfo[playerid][pPnumber] = strval(string);
cache_get_row(0, 52, string); PlayerInfo[playerid][pPhousekey] = strval(string);
cache_get_row(0, 53, string); PlayerInfo[playerid][pPbiskey] = strval(string);
cache_get_row(0, 54, string); PlayerInfo[playerid][pDisabled] = strval(string);
cache_get_row(0, 55, string); PlayerInfo[playerid][ppillsTime] = strval(string);
cache_get_row(0, 56, string); PlayerInfo[playerid][pCarLic] = strval(string);
cache_get_row(0, 57, string); PlayerInfo[playerid][pFlyLic] = strval(string);
cache_get_row(0, 58, string); PlayerInfo[playerid][pBoatLic] = strval(string);
cache_get_row(0, 59, string); PlayerInfo[playerid][pFishLic] = strval(string);
cache_get_row(0, 60, string); PlayerInfo[playerid][pGunLic] = strval(string);
cache_get_row(0, 61, string); PlayerInfo[playerid][pGun1] = strval(string);
cache_get_row(0, 62, string); PlayerInfo[playerid][pGun2] = strval(string);
cache_get_row(0, 63, string); PlayerInfo[playerid][pGun3] = strval(string);
cache_get_row(0, 64, string); PlayerInfo[playerid][pGun4] = strval(string);
cache_get_row(0, 65, string); PlayerInfo[playerid][pAmmo1] = strval(string);
cache_get_row(0, 66, string); PlayerInfo[playerid][pAmmo2] = strval(string);
cache_get_row(0, 67, string); PlayerInfo[playerid][pAmmo3] = strval(string);
cache_get_row(0, 68, string); PlayerInfo[playerid][pAmmo4] = strval(string);
cache_get_row(0, 69, string); PlayerInfo[playerid][pCarTime] = strval(string);
cache_get_row(0, 70, string); PlayerInfo[playerid][pCDPlayer] = strval(string);
cache_get_row(0, 71, string); PlayerInfo[playerid][pWins] = strval(string);
cache_get_row(0, 72, string); PlayerInfo[playerid][pLoses] = strval(string);
cache_get_row(0, 73, string); PlayerInfo[playerid][pAlcoholPerk] = strval(string);
cache_get_row(0, 74, string); PlayerInfo[playerid][pDrugPerk] = strval(string);
cache_get_row(0, 75, string); PlayerInfo[playerid][pMiserPerk] = strval(string);
cache_get_row(0, 76, string); PlayerInfo[playerid][pPainPerk] = strval(string);
cache_get_row(0, 77, string); PlayerInfo[playerid][pTraderPerk] = strval(string);
cache_get_row(0, 78, string); PlayerInfo[playerid][pTut] = strval(string);
cache_get_row(0, 79, string); PlayerInfo[playerid][pWarns] = strval(string);
cache_get_row(0, 80, string); PlayerInfo[playerid][pAdjustable] = strval(string);
cache_get_row(0, 81, string); PlayerInfo[playerid][pMarried] = strval(string);
cache_get_row(0, 82, string); strmid(PlayerInfo[playerid][pMarriedTo], string, 0, strlen(string), MAX_PLAYER_NAME);
cache_get_row(0, 83, string); PlayerInfo[playerid][pPassport] = strval(string);
cache_get_row(0, 84, string); PlayerInfo[playerid][pCrack] = strval(string);
cache_get_row(0, 85, string); PlayerInfo[playerid][pCabinetTime] = strval(string);
cache_get_row(0, 86, string); PlayerInfo[playerid][pVip] = strval(string);
cache_get_row(0, 87, string); WantedLevel[playerid] = strval(string);
cache_get_row(0, 88, string); PlayerInfo[playerid][pWJail] = strval(string);
cache_get_row(0, 89, string); PlayerInfo[playerid][pPremiumPoints] = strval(string);
cache_get_row(0, 90, string); PlayerInfo[playerid][pSlotMasina] = strval(string);
cache_get_row(0, 91, string); PlayerInfo[playerid][pHotelSpawnLS] = strval(string);
cache_get_row(0, 92, string); PlayerInfo[playerid][pPPenalizare] = strval(string);
cache_get_row(0, 93, string); PlayerInfo[playerid][pSSalariu] = strval(string);
cache_get_row(0, 94, string); PlayerInfo[playerid][Pistol] = strval(string);
cache_get_row(0, 95, string); PlayerInfo[playerid][SPistol] = strval(string);
cache_get_row(0, 96, string); PlayerInfo[playerid][Desert] = strval(string);
cache_get_row(0, 97, string); PlayerInfo[playerid][Shotgun] = strval(string);
cache_get_row(0, 98, string); PlayerInfo[playerid][Sawnoff] = strval(string);
cache_get_row(0, 99, string); PlayerInfo[playerid][Spas12] = strval(string);
cache_get_row(0, 100, string); PlayerInfo[playerid][Uzi] = strval(string);
cache_get_row(0, 101, string); PlayerInfo[playerid][MP5] = strval(string);
cache_get_row(0, 102, string); PlayerInfo[playerid][AK47] = strval(string);
cache_get_row(0, 103, string); PlayerInfo[playerid][M4] = strval(string);
cache_get_row(0, 104, string); PlayerInfo[playerid][Rifle] = strval(string);
cache_get_row(0, 105, string); PlayerInfo[playerid][pDeLuatPD] = strval(string);
cache_get_row(0, 106, string); PlayerInfo[playerid][pDeLuatFPD] = strval(string);
cache_get_row(0, 107, string); PlayerInfo[playerid][pJetPack] = strval(string);
cache_get_row(0, 108, string); PlayerQuiz[playerid][pIntrebari] = strval(string);
cache_get_row(0, 109, string); PlayerQuiz[playerid][pTotalIntrebari] = strval(string);
cache_get_row(0, 110, string); PlayerInfo[playerid][pCredit] = strval(string);
cache_get_row(0, 111, string); PlayerInfo[playerid][pMisiuni] = strval(string);
cache_get_row(0, 112, string); strmid(PlayerInfo[playerid][pLastLogin], string, 0, strlen(string), 100);
cache_get_row(0, 113, string); PlayerInfo[playerid][pInregistratOras] = strval(string);
}
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
return 1;
}
How does your Functie macro work? Does it generate public function?
|
//before
cache_get_data(rows, fields);
//add
printf("Callback called: with %d rows and %d fields", rows, fields);