Sergey_Rich
Умник
Привет всем, пишу мод с 0, образовался такой косяк, не сохраняются аккаунты. А именно, регистрация/авторизация происходит нормально, но сам аккаунт не сохраняется, например, сделал тест в автошколе, права получаешь, перезаходишь - их нет.
Вот сохранение:
Вот авторизация
Вот сохранение:
PHP:
stock SavePlayer(p) {
#define scf(%0,%1,%2) format(%1,sizeof(%1),%2), strcat(%0,%1)
if(!GetPVarInt(p, "Logged")) return 1;
static str[65];
format(str,sizeof(str),"UPDATE `accounts` SET ");
scf(str, str, "`Key`='%d',",PlayerInfo[p][Key]);
scf(str, str, "`Level`='%d',",PlayerInfo[p][pLevel]);
scf(str, str, "`Exp`='%d',",PlayerInfo[p][pExp]);
scf(str, str, "`CarLic`='%d',",PlayerInfo[p][pCarLic]);
scf(str, str, "`Sex`='%d',",PlayerInfo[p][pSex]);
scf(str, str, "WHERE `Name`='%s'",Name(p));
mysql_function_query(connectionHandle, str, false, "", "");
return 1;
}
PHP:
forward LoginCallback(i, password[]);
public LoginCallback(i, password[])
{
new rows, fields, string[144], maximum[128];
cache_get_data(rows, fields);
if(!rows)
{
if(GetPVarInt(i, "wrongPass") == 2) return send(i, COLOR_WHITE,"Вы ввели 3 раза неверный пароль, поэтому были кикнуты сервером."), Kick(i);
SetPVarInt(i, "wrongPass", GetPVarInt(i, "wrongPass")+1);
format(string, sizeof(string), "Неверный пароль(осталось %i/3)\nВведите пароль:", 3 - GetPVarInt(i, "wrongPass"));
ShowPlayerDialog(i, 2, DIALOG_STYLE_PASSWORD, "Авторизация", string, "Вход", "Отмена");
return 1;
}
cache_get_field_content(0, "Level", maximum), PlayerInfo[i][pLevel] = strval(maximum);
cache_get_field_content(0, "Exp", maximum), PlayerInfo[i][pExp] = strval(maximum);
cache_get_field_content(0, "CarLic", maximum), PlayerInfo[i][pCarLic] = strval(maximum);
cache_get_field_content(0, "Sex", maximum), PlayerInfo[i][pSex] = strval(maximum);
SetPVarInt(i, "Logged", 1);
send(i, COLOR_WHITE, "Вы успешно авторизовались!");
SpawnPlayer(i), SavePlayer(i);
return 1;
}
Последнее редактирование:
