SemBaru
Умник
Доброго времени суток пользователи Pawno-Info!
Я сделал запись в базу инфо об игре о каждом входе в игру.
Все записывается нормально.
Хочу сделать вывод для игрока, но не получается.
Какие проблемы?
Вот запись в базу при успешном коннекте:
Вот загрузка таблицы connections
Выводит все правильно.
Вот команда, чтобы узнать свои последние входы в игру:
Помогите пожалуйста, с меня большущий лайк.
Я сделал запись в базу инфо об игре о каждом входе в игру.
Все записывается нормально.
Хочу сделать вывод для игрока, но не получается.
Какие проблемы?
Вот запись в базу при успешном коннекте:
PHP:
new ip[32];
new hour, minuite, second;
new day, month, year;
getdate(year, month, day);
gettime(hour, minuite, second);
GetPlayerIp(playerid, ip, 32);
mysql_format(MySQL, mquery, sizeof(mquery), "INSERT INTO "TABLE_CONNECTS" (ID, Name, IP, Date, Time) VALUES ('%i', '%e', '%e', '%d.%d.%d', '%02d:%02d:%02d')", TOTALCONNECTS, GetName(playerid), ip, day, month, year, hour, minuite, second);
PHP:
void LoadConnects()
{
new time = GetTickCount();
if(!cache_num_rows()) return true;
for(int idx = 0, ids = 1; idx < cache_num_rows(); ++idx, ++ids)
{
cache_get_value_index_int(idx, 0, ConnectsInfo[ids][pID]);
cache_get_value_index_int(idx, 1, ConnectsInfo[ids][pName]);
cache_get_value_index_int(idx, 2, ConnectsInfo[ids][pIP]);
cache_get_value_index_int(idx, 3, ConnectsInfo[ids][pDate]);
cache_get_value_index_int(idx, 4, ConnectsInfo[ids][pTime]);
TOTALCONNECTS++;
}
printf("[Load connects]: loading %i/%i ms", TOTALCONNECTS, GetTickCount() - time);
return true;
}
Вот команда, чтобы узнать свои последние входы в игру:
PHP:
CMD:info(playerid, params[])
{
new ip, Date, time;
new Cache:result = mysql_query(MySQL, "select `ID` from `connections`");
if(!cache_num_rows()) return SendClientMessage(playerid, -1, "Нет последних входов!");
int str[64], strr[1024];
format(str, sizeof(str), ""WHITE"Дата\t\t"WHITE"Время\t\t"WHITE"IP\n");
strcat(strr, str);
for(int i = 0; i < cache_num_rows(); i++)
{
cache_get_value_index_int(i, 2, ip);
cache_get_value_index_int(i, 3, Date);
cache_get_value_index_int(i, 4, time);
format(str, sizeof(str), ""WHITE"%s\t\t%d\t\t%i\n", date("%dd.%mm.%yyyy", Date), time, ip);
strcat(strr, str);
}
cache_delete(result);
ShowPlayerDialog(playerid, D_NULL, DIALOG_STYLE_TABLIST_HEADERS, "Последние входы в игру", strr, "Мне пора", "");
return true;
}
Последнее редактирование:
