Помогите уже не 1 раз пишу почему так не сохранияется другое
вот бд
![](http://ihost.pro-pawn.ru/image.php?di=2EU5)
вот всё что я добавил
PHP код:
enum pInfo
{
pID,//ID
pPass[34],// Пароль
pEmail[34],
pAdmin,
pSkin,
pSex,
pName[30],
pCash,
pLevel,
pRegiste
}
new PlayerInfo[MAX_PLAYERS][pInfo];
PHP код:
stock SavePlayer(playerid)
{
if(GetPVarInt(playerid,"Logged") > 0)
{
new query_string[(21)+(20+MAX_PLAYER_NAME)+(19+MAX_PLAYER_NAME)+(16+30)] = "UPDATE `Accounts` SET";
format(query_string, sizeof(query_string), "%s `Name` = '%s',", query_string, PlayerInfo[playerid][pName]);
format(query_string, sizeof(query_string), "%s `Password` = '%s'", query_string, PlayerInfo[playerid][pPass]);
format(query_string, sizeof(query_string), "%s `Skin` = '%d'", query_string, PlayerInfo[playerid][pSkin]);
format(query_string, sizeof(query_string), "%s `Sex` = '%d'", query_string, PlayerInfo[playerid][pSex]);
format(query_string, sizeof(query_string), "%s `Cash` = '%d'", query_string, PlayerInfo[playerid][pCash]);
format(query_string, sizeof(query_string), "%s `Level` = '%d'", query_string, PlayerInfo[playerid][pLevel]);
format(query_string, sizeof(query_string), "%s `Reg` = '%d'", query_string, PlayerInfo[playerid][pRegister]);
format(query_string, sizeof(query_string), "%s WHERE `Name` = '%s'", query_string, GN(playerid));
mysql_function_query(mysql_variable, query_string, false, "", "");
}
return true;
}
PHP код:
forward LoginCallback(playerid, password[]);
public LoginCallback(playerid, password[])
{
new rows, fields, string[144], maximum[128] ;
cache_get_data(rows, fields);
if(!rows)
{
if(GetPVarInt(playerid, "wrongPass") == 2)
return SendClientMessage(playerid,COLOR_RED,"Вы ввели 3 раза неверный пароль, и в целях безопастности вы были кикнуты с сервера!"), Kick(playerid);
SetPVarInt(playerid, "wrongPass", GetPVarInt(playerid, "wrongPass")+1);
format(string, sizeof(string), "{FFFFFF}Добро пожаловать на сервер {01B866}"NameServer"{FFFFFF}\n\nВаш аккаунт зарегистрирован у нас на сервере.\nВведите пароль в данное окно и нажмите кнопку ввод.\n\nВведите пароль: {FF0000}Неверный пароль осталось [%d/3 попыток]",GetPVarInt(playerid,"wrongPass"));
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "{FFFF00}Авторизация", string, "Вход", "Отмена");
return 1;
}
cache_get_field_content(0, "ID", maximum), PlayerInfo[playerid][pID] = strval(maximum);
cache_get_field_content(0, "Password", maximum), strmid(PlayerInfo[playerid][pPass], maximum, 0, strlen(maximum), 32);
cache_get_field_content(0, "Email", maximum), strmid(PlayerInfo[playerid][pEmail], maximum, 0, strlen(maximum), 32);
cache_get_field_content(0, "Level", maximum), PlayerInfo[playerid][pLevel] = strval(maximum);
cache_get_field_content(0, "Skin", maximum), PlayerInfo[playerid][pSkin] = strval(maximum);
cache_get_field_content(0, "Sex", maximum), PlayerInfo[playerid][pSex] = strval(maximum);
cache_get_field_content(0, "Cash", maximum), PlayerInfo[playerid][pCash] = strval(maximum);
cache_get_field_content(0, "Reg", maximum), PlayerInfo[playerid][pRegister] = strval(maximum);
if(PlayerInfo[playerid][pRegister] == 0)
{
PlayerInfo[playerid][pRegister] = 1;
PlayerInfo[playerid][pCash] = 970;
}
SetPVarInt(playerid, "Logged", 1);
SendClientMessage(playerid, -1, "{00FF00}Вы успешно авторизовались!");
SpawnPlayer(playerid);
SavePlayer(playerid);
return 1;
}
PHP код:
stock OnPlayerRegister(playerid, password[])
{
new str[198];
format(str, sizeof(str), "INSERT INTO `Accounts` (`Name`, `Password`) VALUES ('%s', '%s')", GN(playerid), password);
mysql_function_query(mysql_variable, str, false, "OnPlayerLogin","d", playerid);
return true;
}
stock OnPlayerLogin(playerid,password[])
{
new str[128];
format(str, sizeof(str),"SELECT * FROM `Accounts` WHERE `Name` = '%s' AND `Password` = '%s'", GN(playerid), password);
mysql_function_query(mysql_variable, str, true, "LoginCallback","ds", playerid, password);
return true;
}