Hello. I'm trying to update a gamemode, which uses MySQL R39, to R40. I'm using maddinat0r's
. I need help converting player stats loading.
Код:
forward OnPlayerLogin(playerid, tmp[]);
public OnPlayerLogin(playerid, tmp[])
{
if(!GetPVarInt(playerid, "Logged")) return 1;
new rows, fields;
cache_get_data(rows, fields);
if(!rows)
{
PlayerLogTries[playerid]++;
if(PlayerLogTries[playerid] == 4)
{
SendClientMessage(playerid,COLOR_RED, "Вы несколько раз ввели неверный пароль! Для выхода из игры введите: {ffffff}/q(uit)");
return SKick(playerid, 52);
}
new string[100];
format(string, sizeof(string), "{F04245}Вы ввели неверный пароль!\nУ вас осталось {FFFFFF}%d {F04245}попыток", 3 - PlayerLogTries[playerid]);
ShowPlayerDialog(playerid, D_ERRORPAS, DIALOG_STYLE_MSGBOX, "{FFFFFF}Ошибка", string, "Повтор", "Выйти");
return 1;
}
PI[playerid][pID] = cache_get_value_index_int(0, 0); // id
//cache_get_value_index(0, 2, PI[playerid][pPassword], 32); // password
cache_get_value_index(0, 3, PI[playerid][pLastIP], 16); // ip
cache_get_value_index(0, 4, PI[playerid][pNumberVehicle], 20); // veh_number
PI[playerid][pRegVehicle] = cache_get_value_index_int(0, 5); // veh_reg
PI[playerid][pAdmin] = cache_get_value_index_int(0, 6); // admin
PI[playerid][pSecurityCode] = cache_get_value_index_int(0, 7); // securitycode
PI[playerid][pCheckCode] = cache_get_value_index_int(0, 8); // checkcode
cache_get_value_index(0, 9, PI[playerid][pMail], 64); // mail
PI[playerid][pLevel] = cache_get_value_index_int(0, 10); // level
PI[playerid][pCash] = cache_get_value_index_int(0, 11); // cash
PI[playerid][pBank] = cache_get_value_index_int(0, 12); // bank
PI[playerid][pExp] = cache_get_value_index_int(0, 13); // exp
cache_get_value_index(0, 14, PI[playerid][pRegIP], 16); // regip
cache_get_value_index(0, 15, PI[playerid][pRegData], 15); // datareg
PI[playerid][pLeader] = cache_get_value_index_int(0, 16); // leader
PI[playerid][pTempLeader] = cache_get_value_index_int(0, 17); // templeader
PI[playerid][pMember] = cache_get_value_index_int(0, 18); // member
PI[playerid][pRank] = cache_get_value_index_int(0, 19); // rank
PI[playerid][pWarn] = cache_get_value_index_int(0, 20); // warn
PI[playerid][pSex] = cache_get_value_index_int(0, 21); // sex
PI[playerid][pAge] = cache_get_value_index_int(0, 22); // age
PI[playerid][pModel] = cache_get_value_index_int(0, 23); // model
PI[playerid][pMemberSkin] = cache_get_value_index_int(0, 24); // memberskin
cache_get_value_index(0, 25, PI[playerid][pLics], 16); // lic
PI[playerid][pMuted] = cache_get_value_index_int(0, 28); // mute
PI[playerid][pPick] = cache_get_value_index_int(0, 29); // pick
PI[playerid][pCheckTime] = cache_get_value_index_int(0, 30); //checktime
PI[playerid][pNews] = cache_get_value_index_int(0, 31); // news
//PI[playerid][pPhone] = cache_get_value_index_int(0, 32); // phone
PI[playerid][pPhoneNumber] = cache_get_value_index_int(0, 33); // phonenumber
cache_get_value_index(0, 34, PI[playerid][pTexts], 20); // text
PI[playerid][pJail] = cache_get_value_index_int(0, 35); // jail
PI[playerid][pJailTime] = cache_get_value_index_int(0, 36); // jailtime
PI[playerid][pWanted] = cache_get_value_index_int(0, 37); // wanted
PI[playerid][pWantedTime] = cache_get_value_index_int(0, 38); // wantedtime
cache_get_value_index(0, 39, PI[playerid][pWantedWho], MAX_PLAYER_NAME); // wantedwho
cache_get_value_index(0, 40, PI[playerid][pWantedReason], 32); // wantedreason
PI[playerid][pHeal] = cache_get_row_float(0, 41); // heal
PI[playerid][pDrugs] = cache_get_value_index_int(0, 42); // drugs
PI[playerid][pPatron] = cache_get_value_index_int(0, 43); // patron
PI[playerid][pGunAmount] = cache_get_value_index_int(0, 44); // gunamount
PI[playerid][pCrimes] = cache_get_value_index_int(0, 45); // crimes
PI[playerid][pJob] = cache_get_value_index_int(0, 46); // job
PI[playerid][pMarried] = cache_get_value_index_int(0, 47); // married
cache_get_value_index(0, 48, PI[playerid][pWhoMarried], MAX_PLAYER_NAME); // whomarried
cache_get_value_index(0, 49, PI[playerid][pReferal], MAX_PLAYER_NAME); // referal
PI[playerid][pRefMoney] = cache_get_value_index_int(0, 50); // refmoney
PI[playerid][pPayCheck] = cache_get_value_index_int(0, 51); // paycheck
PI[playerid][pCharity] = cache_get_value_index_int(0, 52); // charity
PI[playerid][pVip] = cache_get_value_index_int(0, 53); // vip
PI[playerid][pVipTime] = cache_get_value_index_int(0, 54); // viptime
PI[playerid][pTime] = cache_get_value_index_int(0, 55); // time
//PI[playerid][pAdminTime] = cache_get_value_index_int(0, 56); // admintime
PI[playerid][pFightStyle] = cache_get_value_index_int(0, 57); // fstyle
PI[playerid][pCredits] = cache_get_value_index_int(0, 58); // credits
PI[playerid][pTotalCredits] = cache_get_value_index_int(0, 59); // totalcredits
PI[playerid][pSkin][0] = cache_get_value_index_int(0, 60); // skin1
PI[playerid][pSkin][1] = cache_get_value_index_int(0, 61); // skin2
PI[playerid][pSkin][2] = cache_get_value_index_int(0, 62); // skin3
PI[playerid][pSpawnChange] = cache_get_value_index_int(0, 63); // spawnchange
PI[playerid][pGunSkill][0] = cache_get_value_index_int(0, 64); // sdpistol
PI[playerid][pGunSkill][1] = cache_get_value_index_int(0, 65); // deserteagle
PI[playerid][pGunSkill][2] = cache_get_value_index_int(0, 66); // shotgun
PI[playerid][pGunSkill][3] = cache_get_value_index_int(0, 67); // mp5
PI[playerid][pGunSkill][4] = cache_get_value_index_int(0, 68); // ak47
PI[playerid][pGunSkill][5] = cache_get_value_index_int(0, 69); // m4
PI[playerid][pGunSkill][6] = cache_get_value_index_int(0, 70); // pistol
PI[playerid][pGunSkill][7] = cache_get_value_index_int(0, 71); // microuzi
PI[playerid][pHunger] = cache_get_value_index_int(0, 72); // hunger
PI[playerid][pHealthS] = cache_get_value_index_int(0, 73); // healths
PI[playerid][pSportExp] = cache_get_value_index_int(0, 74); // sportexp
PI[playerid][pOnline] = cache_get_value_index_int(0, 75); // online
PI[playerid][pZakon] = cache_get_value_index_int(0, 76); // zakon
PI[playerid][pCity] = cache_get_value_index_int(0, 77); // city
cache_get_value_index(0, 78, PI[playerid][pRepcars], 16); // repcar
PI[playerid][pBed] = cache_get_value_index_int(0, 79); // bed
PI[playerid][pWatch] = cache_get_value_index_int(0, 80); // watch
PI[playerid][pCiggare] = cache_get_value_index_int(0, 81); // ciggare
PI[playerid][pSprunk] = cache_get_value_index_int(0, 82); // sprunk
PI[playerid][pMask] = cache_get_value_index_int(0, 83); // mask
PI[playerid][pPhoneBalance] = cache_get_value_index_int(0, 84); // phonebalance
PI[playerid][pTruckSkill] = cache_get_value_index_int(0, 85); // truckskill
PI[playerid][cModel] = cache_get_value_index_int(0, 86); // cModel
PI[playerid][cClass] = cache_get_value_index_int(0, 87); // cClass
PI[playerid][cFuel] = cache_get_value_index_int(0, 88); // cFuel
PI[playerid][cColor][0] = cache_get_value_index_int(0, 89); // cColor1
PI[playerid][cColor][1] = cache_get_value_index_int(0, 90); // cColor2
PI[playerid][cLock] = cache_get_value_index_int(0, 91); // cLock
PI[playerid][cCost] = cache_get_value_index_int(0, 92); // cCost
cache_get_value_index(0, 93, PI[playerid][cVehcom], 64); // cVehcom
PI[playerid][cPaintjob] = cache_get_value_index_int(0, 94); // cPaintjob
PI[playerid][pAptechka] = cache_get_value_index_int(0, 95); // aptechka
PI[playerid][pVoennik] = cache_get_value_index_int(0, 96); // Voennik
PI[playerid][pMusic] = cache_get_value_index_int(0, 97); // music
cache_get_value_index(0, 98, PI[playerid][pImproves], 32); // improves
PI[playerid][pSettings] = cache_get_value_index_int(0, 100); // settings
PhoneNumbers[playerid][0] = cache_get_value_index_int(0, 101); // phnumber1
PhoneNumbers[playerid][1] = cache_get_value_index_int(0, 102); // phnumber2
PhoneNumbers[playerid][2] = cache_get_value_index_int(0, 103); // phnumber3
PhoneNumbers[playerid][3] = cache_get_value_index_int(0, 104); // phnumber4
PhoneNumbers[playerid][4] = cache_get_value_index_int(0, 105); // phnumber5
PhoneNumbers[playerid][5] = cache_get_value_index_int(0, 106); // phnumber6
PhoneNumbers[playerid][6] = cache_get_value_index_int(0, 107); // phnumber7
PhoneNumbers[playerid][7] = cache_get_value_index_int(0, 108); // phnumber8
//PI[playerid][pVehicleKey] = cache_get_value_index_int(0, 109); // vehiclekey
PI[playerid][pMailConfirmed] = cache_get_value_index_int(0, 110); // mailconf
PI[playerid][pFishki] = cache_get_value_index_int(0, 111); // fishki
new l_guns[56], l_ammo[56];
cache_get_value_index(0, 26, l_guns, 64); // guns
cache_get_value_index(0, 27, l_ammo, 64); // ammos
Why? I just need an example. All the MySQL loading systems are with similar code. So, if I can convert this one, I will be able to others too.
Код:
forward OnPlayerLogin(playerid, tmp[]);
public OnPlayerLogin(playerid, tmp[])
{
if(!GetPVarInt(playerid, "Logged")) return 1;
new rows = cache_num_rows();
if(!rows)
{
PlayerLogTries[playerid]++;
if(PlayerLogTries[playerid] == 4)
{
SendClientMessage(playerid,COLOR_RED, "Вы несколько раз ввели неверный пароль! Для выхода из игры введите: {ffffff}/q(uit)");
return SKick(playerid, 52);
}
new string[100];
format(string, sizeof(string), "{F04245}Вы ввели неверный пароль!\nУ вас осталось {FFFFFF}%d {F04245}попыток", 3 - PlayerLogTries[playerid]);
ShowPlayerDialog(playerid, D_ERRORPAS, DIALOG_STYLE_MSGBOX, "{FFFFFF}Ошибка", string, "Повтор", "Выйти");
return 1;
}
cache_get_value_int(0, "ID", PI[playerid][pID]);
cache_get_value(0, "Name", PI[playerid][pName], MAX_PLAYER_NAME);
cache_get_value_float(0, "X", PI[playerid][pPosX]);
cache_get_value_float(0, "Y", PI[playerid][pPosY]);
cache_get_value_float(0, "Z", PI[playerid][pPosZ]);
return 1;
}