31.03.2012, 12:16
Всем привет решил перевести свой мод по MySqL...
так еще и не разобрался в нем.. ну вот сделал регистрацию .. вроде работает
Делал вот по этому уроку http://pawno.ru/threads/38779-MySQL-...мы-регистрации
ну как только я решил закинуть в перевести весь мод на мускул (хотя б основные данные ) то у меня получилась вечная регистрация т.е либо нету сохранения либо загрузки помогите в чем проблема
вот код
Заранее огромное спасибо!!
так еще и не разобрался в нем.. ну вот сделал регистрацию .. вроде работает
Делал вот по этому уроку http://pawno.ru/threads/38779-MySQL-...мы-регистрации
ну как только я решил закинуть в перевести весь мод на мускул (хотя б основные данные ) то у меня получилась вечная регистрация т.е либо нету сохранения либо загрузки помогите в чем проблема
вот код
PHP код:
LoadAccount(playerid, password[]) {
new
query[128],
sqlpass[32],
result[5+24+64],
dialog[128];
mysql_real_escape_string(password, sqlpass); // Çàùèòà îò SQL Inject, øèôðóåò êîäèðîâêó.
format(query, sizeof(query), "SELECT * FROM `Accounts` WHERE `Password` = '%s' AND `ID` = '%i'", sqlpass, playerVariable[playerid][aID]);
// SELECT * - âûáðàòü, FROM - ñ òàáëèöû, WHERE - ãäå, ïàðîëü ðàâåí ââåäåííîìó ïàðîëþ è ID ðàâåí èäó íèêà ÷åëîâåêà.
mysql_query(query); // Îòïðàâëÿåì çàïðîñ.
mysql_store_result(); // Ñìîòðèì çàïèñè, êîòîðûå ìû âûáðàëè çàïðîñîì âûøå.
if(mysql_num_rows() == 1) { // Åñëè âûáðàëî òîëüêî 1 àêêàóíò ñ òàêèì ïàðîëåì è ÈÄ - óñïåõ, ïàðîëü ââåäåí âåðíî, çàãðóæàåì äàííûå â ìàññèâ.
mysql_fetch_row_format(result, "|"); // split, äàííûå â ðåçóëüòàòå çàïèñûâàþòñÿ òèïî "1|Snoowker|parol"
sscanf(result,"p<|>dssddddddddddddddddddddddddddddddddddddddddddddddddddd",playerVariable[playerid][aID], playerVariable[playerid][aName], playerVariable[playerid][aPassword],GetWelcomeMoney(playerid),GetPVarInt(playerid, "Kills"),PlayerInfo[playerid][Deaths],
GetPVarInt(playerid, "Deaths"),GetPVarInt(playerid, "Jailed"),GetPVarInt(playerid, "JailTime"),PlayerInfo[playerid][Kills],PlayerInfo[playerid][pSexSe],
PlayerInfo[playerid][ArtAll],PlayerInfo[playerid][PlayerProps],PlayerInfo[playerid][pScore],PlayerInfo[playerid][PPOBePkA],PlayerInfo[playerid][ZatorKaOtela],PlayerInfo[playerid][pDuelRaz],
PlayerInfo[playerid][pDuelWin],PlayerInfo[playerid][pDuelLose],PlayerInfo[playerid][pDragWin],PlayerInfo[playerid][pDragRaz],PlayerInfo[playerid][pDragLose],
PlayerInfo[playerid][pPbiskey],PlayerInfo[playerid][arts1],PlayerInfo[playerid][arts2],PlayerInfo[playerid][arts3],PlayerInfo[playerid][arts4],PlayerInfo[playerid][arts5],
PlayerInfo[playerid][arts6],PlayerInfo[playerid][arts7],PlayerInfo[playerid][arts8],PlayerInfo[playerid][arts9],PlayerInfo[playerid][arts10],PlayerInfo[playerid][arts11],PlayerInfo[playerid][arts12],
PlayerInfo[playerid][arts13],PlayerInfo[playerid][arts14],PlayerInfo[playerid][arts15],PlayerInfo[playerid][arts16],PlayerInfo[playerid][arts17],PlayerInfo[playerid][arts18],
PlayerInfo[playerid][arts19],PlayerInfo[playerid][arts20],PlayerInfo[playerid][arts21],PlayerInfo[playerid][arts22],PlayerInfo[playerid][arts23],PlayerInfo[playerid][arts24],
PlayerInfo[playerid][arts25],PlayerInfo[playerid][arts26],PlayerInfo[playerid][arts27],PlayerInfo[playerid][arts28],PlayerInfo[playerid][arts29],PlayerInfo[playerid][arts30]);
playerVariable[playerid][aLogged] = true;
mysql_free_result(); // Î÷èùàåì ïàìÿòü.
SetPlayerScore(playerid,PlayerInfo[playerid][Kills]);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
if(PlayerInfo[playerid][pLevel] > 0)
{
new string[128];
format(string,sizeof(string),"ÀÊÀÓÍÒ: Âû óñïåøíî çàëîãèíèëèñü. (Óðîâåíü %d)", PlayerInfo[playerid][pLevel] );
return SendClientMessage(playerid,green,string);
}
else return SendClientMessage(playerid,green,"ÀÊÀÓÍÒ: Âû óñïåøíî çàëîãèíèëèñü.");
// return 1;
}
else { // ?? ????? ???????? ??????.
if(playerVariable[playerid][aWrongPassword] == 4) {
SendClientMessage(playerid, COLOR_LIGHTRED, "Èíôî âûêèíóò èç ñåðâåðà ââåë íå ïðàâåëüíûé ïàðîëü");
Kick(playerid);
return 1;
}
playerVariable[playerid][aWrongPassword] ++;
ShowPlayerDialog(playerid,LOGINMENU,DIALOG_STYLE_PASSWORD,"{FF4500}Îøèáêà","{FF7F00}Âû ââåëè íåâåðíûé ïàðîëü\n{FFA500} ââåäèòå ïàðîëü çàíîâî","..::|Ok|::..",".:|Îòìåíà|:.");
}
return 1;
}
//=============================================================
SaveAccount(playerid) { // Ñîõðàíåíèå àêêàóíòà.
if(playerVariable[playerid][aLogged] == true) { // Ïðîâåðêà, åñëè àêêàóíò àâòîðèçîâàí.
CheckMySQLConnection(); // Ïðîâåðÿåì, ïîäêëþ÷åíà ëè ÁÄ.
new
query[814],
sqlname[MAX_PLAYER_NAME],
sqlpass[64];
mysql_real_escape_string(playerVariable[playerid][aName], sqlname);
mysql_real_escape_string(playerVariable[playerid][aPassword], sqlpass);
sscanf(query,"p<|>ssdddddddddddddddddddddddddddddddddddddddddddddddddddd",sqlname, sqlpass, playerVariable[playerid][aID],GetWelcomeMoney(playerid),GetPVarInt(playerid, "Kills"),PlayerInfo[playerid][Deaths],
GetPVarInt(playerid, "Deaths"),GetPVarInt(playerid, "Jailed"),GetPVarInt(playerid, "JailTime"),PlayerInfo[playerid][Kills],PlayerInfo[playerid][pSexSe],
PlayerInfo[playerid][ArtAll],PlayerInfo[playerid][PlayerProps],PlayerInfo[playerid][pScore],PlayerInfo[playerid][PPOBePkA],PlayerInfo[playerid][ZatorKaOtela],PlayerInfo[playerid][pDuelRaz],
PlayerInfo[playerid][pDuelWin],PlayerInfo[playerid][pDuelLose],PlayerInfo[playerid][pDragWin],PlayerInfo[playerid][pDragRaz],PlayerInfo[playerid][pDragLose],
PlayerInfo[playerid][pPbiskey],PlayerInfo[playerid][arts1],PlayerInfo[playerid][arts2],PlayerInfo[playerid][arts3],PlayerInfo[playerid][arts4],PlayerInfo[playerid][arts5],
PlayerInfo[playerid][arts6],PlayerInfo[playerid][arts7],PlayerInfo[playerid][arts8],PlayerInfo[playerid][arts9],PlayerInfo[playerid][arts10],PlayerInfo[playerid][arts11],PlayerInfo[playerid][arts12],
PlayerInfo[playerid][arts13],PlayerInfo[playerid][arts14],PlayerInfo[playerid][arts15],PlayerInfo[playerid][arts16],PlayerInfo[playerid][arts17],PlayerInfo[playerid][arts18],
PlayerInfo[playerid][arts19],PlayerInfo[playerid][arts20],PlayerInfo[playerid][arts21],PlayerInfo[playerid][arts22],PlayerInfo[playerid][arts23],PlayerInfo[playerid][arts24],
PlayerInfo[playerid][arts25],PlayerInfo[playerid][arts26],PlayerInfo[playerid][arts27],PlayerInfo[playerid][arts28],PlayerInfo[playerid][arts29],PlayerInfo[playerid][arts30]);
GetPlayerScore(playerid);
mysql_query(query); // Îòïðàâëÿåì çàïðîñ
}
return 1;
}