new query[1024], pname[24];
GetPlayerName(playerid, pname, 24);
format(query, sizeof(query), "SELECT * FROM `PlayerInfo` WHERE `user` = '%s'", pname);
mysql_query(query);
mysql_store_result();
while(mysql_fetch_row_format(query, "|"))
{
sscanf(query, "p<|>ddddddsddssssdddddddddddddddddddddddddddddddddddddsssdddddddddd",
PlayerInfo[playerid][bank], //Non-String
PlayerTemp[playerid][sm], //Non-String
PlayerInfo[playerid][playerlvl], //Non-String
PlayerInfo[playerid][rpoints], //Non-String
PlayerInfo[playerid][playertime], //Non-String
PlayerInfo[playerid][jail], //Non-String
PlayerInfo[playerid][jailreason], //String
PlayerInfo[playerid][jailtime], //Non-String
PlayerInfo[playerid][banned], //Non-String
PlayerInfo[playerid][banreason], //String
PlayerInfo[playerid][whobannedme], //String
PlayerInfo[playerid][whenigotbanned], //String
PlayerInfo[playerid][forumname], //String
PlayerInfo[playerid][Skin], //Non-String
PlayerInfo[playerid][ranklvl], //Non-String
PlayerInfo[playerid][rentprice], //Non-String
PlayerInfo[playerid][driverlic], //Non-String
PlayerInfo[playerid][flylic], //Non-String
PlayerInfo[playerid][namechanges], //Non-String
PlayerInfo[playerid][boatlic], //Non-String
PlayerInfo[playerid][weaplic], //Non-String
PlayerInfo[playerid][jobtime], //Non-String
PlayerInfo[playerid][jobskill], //Non-String
PlayerInfo[playerid][pbkills], //Non-String
PlayerInfo[playerid][pbdeaths], //Non-String
PlayerInfo[playerid][totalpayt], //Non-String
PlayerInfo[playerid][housenum], //Non-String
PlayerInfo[playerid][tracker], //Non-String
PlayerInfo[playerid][loan], //Non-String
PlayerInfo[playerid][drugs], //Non-String
PlayerInfo[playerid][guns], //Non-String
PlayerInfo[playerid][sguns], //Non-String
PlayerInfo[playerid][sdrugs], //Non-String
PlayerInfo[playerid][power], //Non-String
PlayerInfo[playerid][female], //Non-String
PlayerInfo[playerid][bail], //Non-String
PlayerInfo[playerid][premium], //Non-String
PlayerInfo[playerid][gotphone], //Non-String
PlayerInfo[playerid][phonenumber], //Non-String
PlayerInfo[playerid][phonebook], //Non-String
PlayerInfo[playerid][laptop], //Non-String
PlayerInfo[playerid][age], //Non-String
PlayerInfo[playerid][premiumexpire], //Non-String
PlayerInfo[playerid][playerteam], //Non-String
PlayerInfo[playerid][radio], //Non-String
PlayerInfo[playerid][freq1], //Non-String
PlayerInfo[playerid][freq2], //Non-String
PlayerInfo[playerid][freq3], //Non-String
PlayerInfo[playerid][tutorial], //Non-String
PlayerInfo[playerid][tbanned], //Non-String
PlayerInfo[playerid][city], //String
PlayerInfo[playerid][PTeamName], //String
PlayerInfo[playerid][job], //String
PlayerInfo[playerid][totalruns], //Non-String
PlayerInfo[playerid][fpay], //Non-String
PlayerInfo[playerid][warns], //Non-String
PlayerInfo[playerid][helper], //Non-String
PlayerInfo[playerid][curfreq], //Non-String
PlayerInfo[playerid][rankname], //Non-String
PlayerInfo[playerid][phonechanges], //Non-String
PlayerInfo[playerid][iPod], //Non-String
PlayerInfo[playerid][finvite], //Non-String
PlayerInfo[playerid][fradio]); //Non-String
}
mysql_free_result();
sscanf(query, "p<|>%d%d%d%d%d%d%s%d%d%s%s%s%s%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%s%s%s%d%d%d%d%d%d%d%d%d%d",
[16:58:21] CMySQLHandler::Query(SELECT * FROM `PlayerInfo` WHERE `user` = 'Marcus_Vanderbilt') - Successfully executed. [16:58:21] >> mysql_store_result( Connection handle: 1 ) [16:58:21] CMySQLHandler::StoreResult() - Result was stored. [16:58:21] >> mysql_fetch_row_format( Connection handle: 1 ) [16:58:21] CMySQLHandler::FetchRow() - Return: Marcus_Vanderbilt|0|10000|1|0|0|0|Not Jailed|0|0|None|None|Never|7|9999|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|9999|9999|0|0|0|0|0|0|0|0|0|0|25|0|255|0|666|666|666|0|0|Los Santos|Civilian|CIV|None|0|0|0|0|0|Civ|0|NoBodY|NoBodY|0|0|0|0|None|0|0|0|0|0|0|0|9999 [16:58:21] >> mysql_fetch_row_format( Connection handle: 1 ) [16:58:21] >> mysql_free_result( Connection handle: 1 ) [16:58:21] CMySQLHandler::FreeResult() - Result was successfully free'd.
pawn Код:
|
new query[1024], pname[24];
GetPlayerName(playerid, pname, 24);
format(query, sizeof(query), "SELECT * FROM `PlayerInfo` WHERE `user` = '%s'", pname);
mysql_query(query);
mysql_store_result();
while(mysql_fetch_row_format(query)) {
new data[9][128];
new data2[59];
sscanf(query, "p<|>dddddds[124]dds[124]s[124]s[124]s[124]ddddddddddddddddddddddddddddddddddddds[124]s[124]s[124]dddddddddd",
data2[0], // Bank
data2[1], // Hand
data2[2], // Level
data2[3], // rpoints
data2[4], // playertime
data2[5], // jail
data[0], // jailreason
data2[6], // jailtime
data2[7], // Banned
data[1], // banreason
data[2], // whobannedme
data[3], // whenigotbanned
data[4], // forumname
data2[8], // Skin
data2[9], // ranklvl
data2[10], // rentprice
data2[11], // driverlic
data2[12], // flylic
data2[13], // namechanges
data2[14], // boatlic
data2[15], // weaplic
data2[16], // jobtime
data2[17], // jobskill
data2[18], // pbkills
data2[19], // pbdeaths
data2[20], // totalpayt
data2[21], // housenum
data2[22], // tracker
data2[23], // loan
data2[24], // drugs
data2[25], // guns
data2[26], // sguns
data2[27], // sdrugs
data2[28], // power
data2[29], // female
data2[30], // bail
data2[31], // premium
data2[32], // gotphone
data2[33], // phonenumber
data2[34], // phonebook
data2[35], // laptop
data2[36], // age
data2[37], // premiumexpire
data2[38], // playerteam
data2[39], // radio
data2[40], // freq1
data2[41], // freq2
data2[42], // freq3
data2[43], // tutorial
data2[44], // tbanned
data[5], // city
data[6], // PTeamName
data[7], // job
data2[45], // totalruns
data2[46], // fpay
data2[47], // warns
data2[48], // helper
data2[49], // curfreq
data[8], // rankname
data2[50], // phonechanges
data2[51], // iPod
data2[52], // finvite
data2[53], // fradio
data2[54], // fstock
data2[55], // fwarehouse
data2[56], // fgundealer
data2[57], // fbarrier
data2[58]); // fweplic
// ===============================[Integer loads]
PlayerInfo[playerid][bank] = data2[0];
PlayerTemp[playerid][sm] = data2[1];
SetPlayerMoney(playerid, data2[1]);
PlayerInfo[playerid][playerlvl] = data2[2];
SetPlayerScore(playerid, data2[2]);
PlayerInfo[playerid][rpoints] = data2[3];
PlayerInfo[playerid][playertime] = data2[4];
PlayerInfo[playerid][jail] = data2[5];
PlayerInfo[playerid][jailtime] = data2[6];
PlayerInfo[playerid][banned] = data2[7];
PlayerInfo[playerid][Skin] = data2[8];
SetPlayerSkin(playerid, data2[8]);
PlayerInfo[playerid][ranklvl] = data2[9];
PlayerInfo[playerid][rentprice] = data2[10];
PlayerInfo[playerid][driverlic] = data2[11];
PlayerInfo[playerid][flylic] = data2[12];
PlayerInfo[playerid][namechanges] = data2[13];
PlayerInfo[playerid][boatlic] = data2[14];
PlayerInfo[playerid][weaplic] = data2[15];
PlayerInfo[playerid][jobtime] = data2[16];
PlayerInfo[playerid][jobskill] = data2[17];
PlayerInfo[playerid][pbkills] = data2[18];
PlayerInfo[playerid][pbdeaths] = data2[19];
PlayerInfo[playerid][totalpayt] = data2[20];
PlayerInfo[playerid][housenum] = data2[21];
PlayerInfo[playerid][tracker] = data2[22];
PlayerInfo[playerid][loan] = data2[23];
PlayerInfo[playerid][drugs] = data2[24];
PlayerInfo[playerid][guns] = data2[25];
PlayerInfo[playerid][sguns] = data2[26];
PlayerInfo[playerid][sdrugs] = data2[27];
PlayerInfo[playerid][power] = data2[28];
PlayerInfo[playerid][female] = data2[29];
PlayerInfo[playerid][bail] = data2[30];
PlayerInfo[playerid][premium] = data2[31];
PlayerInfo[playerid][gotphone] = data2[32];
PlayerInfo[playerid][phonenumber] = data2[33];
PlayerInfo[playerid][phonebook] = data2[34];
PlayerInfo[playerid][laptop] = data2[35];
PlayerInfo[playerid][age] = data2[36];
PlayerInfo[playerid][premiumexpire] = data2[37];
PlayerInfo[playerid][playerteam] = data2[38];
PlayerInfo[playerid][radio] = data2[39];
PlayerInfo[playerid][freq1] = data2[40];
PlayerInfo[playerid][freq2] = data2[41];
PlayerInfo[playerid][freq3] = data2[42];
PlayerInfo[playerid][tutorial] = data2[43];
PlayerInfo[playerid][tbanned] = data2[44];
PlayerInfo[playerid][totalruns] = data2[45];
PlayerInfo[playerid][fpay] = data2[46];
PlayerInfo[playerid][warns] = data2[47];
PlayerInfo[playerid][helper] = data2[48];
PlayerInfo[playerid][curfreq] = data2[49];
PlayerInfo[playerid][phonechanges] = data2[50];
PlayerInfo[playerid][iPod] = data2[51];
PlayerInfo[playerid][finvite] = data2[52];
PlayerInfo[playerid][fradio] = data2[53];
PlayerInfo[playerid][fstock] = data2[54];
PlayerInfo[playerid][fwarehouse] = data2[55];
PlayerInfo[playerid][fgundealer] = data2[56];
PlayerInfo[playerid][fbarrier] = data2[57];
PlayerInfo[playerid][fweplic] = data2[58];
// ========================[Strings]
myStrcpy(PlayerInfo[playerid][jailreason], data[0]);
myStrcpy(PlayerInfo[playerid][banreason], data[1]);
myStrcpy(PlayerInfo[playerid][whobannedme], data[2]);
myStrcpy(PlayerInfo[playerid][whenigotbanned], data[3]);
myStrcpy(PlayerInfo[playerid][forumname], data[4]);
myStrcpy(PlayerInfo[playerid][city], data[5]);
myStrcpy(PlayerInfo[playerid][PTeamName], data[6]);
myStrcpy(PlayerInfo[playerid][job], data[7]);
myStrcpy(PlayerInfo[playerid][rankname], data[8]);
}
mysql_free_result();