John_Aberto
Умник
Привет всем. Не происходит сохранение в базу данных.
чат лог сервера:
Сток сохранения:
Команда:
И еще одна проблема. Если выдаю себе админ левел 0, прописав /admins, будет так:
Код:
чат лог сервера:
PHP:
[14:36:48] MySQL соединение установленно.
[14:36:48] Number of vehicle models: 0
[14:37:07] Incoming connection: 25.106.56.217:59947
[14:37:07] [join] Jonathan_Mathers has joined the server (0:25.106.56.217)
[14:37:20] EID: 1064 | Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `AdminLevel` = '2'' at line 1 | Query: WHERE `AdminLevel` = '2'
[14:37:26] EID: 1064 | Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= '1'' at line 1 | Query: UPDATE `accounts` `AdminLevel` = '1'
[14:37:31] [part] Jonathan_Mathers has left the server (0:1)
[14:37:31] EID: 1064 | Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `AdminLevel` = '1'' at line 1 | Query: WHERE `AdminLevel` = '1'
PHP:
stock OnPlayerUpdateAccounts(playerid)
{
if(pInfo[playerid][gPlayerLogged] == true)
{
f(sm, "UPDATE `accounts` SET `Password`, `Level` = '%d'", pInfo[playerid][pPassword], pInfo[playerid][pLevel]);
f(sm, "WHERE `Name` = '%s'", PlayerName(playerid));
f(sm, "WHERE `AdminLevel` = '%d'", pInfo[playerid][pAdminLevel]);
mysql_function_query(mysql, sm, true, "AffectUpdate", "i" , playerid);
}
return 1;
}
PHP:
if(strcmp(cmd, "/aset", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SCM(playerid, color_grey, "* Используйте: /aset [playerid/PartOfName] [level(0-5)]");
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SCM(playerid, color_grey, "* Используйте: /aset [playerid/PartOfName] [level(0-5)]");
if(!IsPlayerConnected(giveplayerid)) return SCM(playerid, color_grey, "* Игрок не найден!");
level = strval(tmp);
if(level > 6 || level < 0) return SCM(playerid, color_grey, "* Неизвестное число! Используйте с 1 по 5!");
pInfo[playerid][pAdminLevel] = level;
switch(level)
{
case 0:
{
SendMes(playerid, color_lime, "* Вы обнулили админ уровень у %s", PlayerName(giveplayerid));
SendMes(giveplayerid, color_lime, "* Администратор %s обнулил вам админ уровень.", PlayerName(playerid));
}
case 1:
{
SCM(giveplayerid, color_grey, "* Добро пожаловать! Справки по командам: /ahelp, подробную информацию вы можете посмотреть на нашем сайте: globalpw.ru");
SendMes(playerid, color_lime, "* Вы назначили %s 1 уровня администрирования.", PlayerName(giveplayerid), level);
SendMes(giveplayerid, color_lime, "* Администратор %s назначил вас администратором %d уровня. Успехов!", PlayerName(playerid), level);
}
default:
{
SCM(giveplayerid, color_grey, "* Вам доступны новые команды, введите /ahelp.");
SendMes(playerid, color_lime, "* Вы повысили %s до %d уровня администрирования.", PlayerName(giveplayerid), level);
SendMes(giveplayerid, color_lime, "* Администратор %s повысил/понизил ваш админ уровень до %d.", PlayerName(playerid), level);
}
}
f(sm, "UPDATE `accounts` `AdminLevel` = '%d'", pInfo[playerid][pAdminLevel]);
mysql_function_query(mysql, sm, true, "AffectUpdate", "i" , playerid);
return 1;
}
И еще одна проблема. Если выдаю себе админ левел 0, прописав /admins, будет так:
PHP:
* Админ: Jonathan_Mathers[id: 0] admlvl: [COLOR="#FF0000"]0[/COLOR]
PHP:
if(strcmp("/admins", cmdtext, true, 7) == 0)
{
foreach(Player, i)
{
SCM(playerid, color_grey, "Админы онлайн:");
if(pInfo[i][pAdminLevel] >= 0)
{
f(sm, "* Админ: %s[id: %d] admlvl: %d", PlayerName(i), i, pInfo[i][pAdminLevel]); SCM(playerid, color_grey, sm);
}
}
return 1;
}
