stock ExibirLog(playerid, log[], lines = 5, bool:checksize = true)
{
new str[128];
if(ShowLogLines[playerid] > 0) lines = ShowLogLines[playerid];
if(ShowLogLines[playerid] > 100) ShowLogLines[playerid] = 100;
if(!fexist(log)){
format(str, sizeof(str), "| LOG |: O arquivo nгo existe: {C0C0C0}%s", log);
SendClientMessage(playerid,0xFF0000FF,str);
return 1;}
new Buffer[1000],TotalLines,Lines;
new File:LogFile = fopen(log, io_read);
if(checksize == true)
{
if(flength(LogFile) > 512000) //500KB
{
fclose(LogFile);
SendClientMessage(playerid,0xFF0000FF,"| ERRO | O arquivo de log nгo pode ser exibido por passar do tamanho limite (500KB)");
return 1;
}
}
while(fread(LogFile, Buffer)) TotalLines++;
fseek(LogFile, seek_start);
format(str, sizeof(str), "| LOG |: Lendo as ъltimas %i linhas do arquivo: {C0C0C0}%s", lines, log);
SendClientMessage(playerid,0x00FF00FF,str);
while(fread(LogFile, Buffer))
{
Lines++;
if(TotalLines - Lines < lines) ShowPlayerDialog(playerid,1000,DIALOG_STYLE_MSGBOX,"{FF0000}Logs!",Buffer,"Fechar","");
}
SendClientMessage(playerid,0x00FF00FF,"| LOG |: Leitura efetuada com sucesso!");
fclose(LogFile);
return 1;
}
[23.8.2017 0:12:18] [BvD]Dean. desbaniu a conta + IP de [BvD]Briggs_
[23.8.2017 0:18:33] [BvD]Dean. desbaniu a conta + IP de [BvD]Briggs_
[23.8.2017 0:34:49] [BvD]Dean. desbaniu a conta + IP de [BvD]Briggs_
[25.8.2017 22:20:35] [BvD]Dean. desbaniu a conta + IP de Gafanhoto..
[27.8.2017 16:31:35] [BvD]Negan. desbaniu a conta + IP de [BvD]Dean.
[29.8.2017 23:32:0] [CSS]Dean. desbaniu a conta + IP de [CSS]Smiley_
[30.8.2017 19:16:18] [CSS]Briggs_ desbaniu a conta + IP de [CSS]Dean.
[30.8.2017 20:42:50] [CSS]Dean. desbaniu a conta + IP de [CSS]Smiley_
[30.8.2017 21:6:42] [CSS]Dean. desbaniu a conta + IP de [CSS]Smiley_
[17.9.2017 12:31:15] [CSS]Dean. desbaniu a conta + IP de [CSS]Negan.
[17.9.2017 12:38:47] [CSS]Dean. desbaniu a conta + IP de [CSS]Negan.
[17.9.2017 12:50:10] [CSS]Negan. desbaniu a conta + IP de [CSS]Dean.
[17.9.2017 13:0:7] [CSS]Dean. desbaniu a conta + IP de [CSS]Negan.
[28.9.2017 11:29:18] [CSS]Negan. desbaniu a conta + IP de [CSS]Dean.
stock ExibirLog(playerid, log[], lines = 5, bool:checksize = true)
{
new str[128];
if(ShowLogLines[playerid] > 0) lines = ShowLogLines[playerid];
if(ShowLogLines[playerid] > 100) ShowLogLines[playerid] = 100;
if(!fexist(log)){
format(str, sizeof(str), "| LOG |: O arquivo nгo existe: {C0C0C0}%s", log);
SendClientMessage(playerid,0xFF0000FF,str);
return 1;}
new Buffer[256],TotalLines,Lines;
new File:LogFile = fopen(log, io_read);
if(checksize == true)
{
if(flength(LogFile) > 512000) //500KB
{
fclose(LogFile);
SendClientMessage(playerid,0xFF0000FF,"| ERRO | O arquivo de log nгo pode ser exibido por passar do tamanho limite (500KB)");
return 1;
}
}
while(fread(LogFile, Buffer)) TotalLines++;
fseek(LogFile, seek_start);
format(str, sizeof(str), "| LOG |: Lendo as ъltimas %i linhas do arquivo: {C0C0C0}%s", lines, log);
SendClientMessage(playerid,0x00FF00FF,str);
new dialog[1000];
while(fread(LogFile, Buffer))
{
Lines++;
if(TotalLines - Lines < lines) strcat(dialog, Buffer);
}
ShowPlayerDialog(playerid,1000,DIALOG_STYLE_MSGBOX,"{FF0000}Logs!",dialog,"Fechar","");
SendClientMessage(playerid,0x00FF00FF,"| LOG |: Leitura efetuada com sucesso!");
fclose(LogFile);
return 1;
}
Vocк tem que formatar as linhas em uma string e depois mostrar a dialog com ela.
PHP код:
|