Portal SAMP
[Pedido] Sistema De Logs - Versão de Impressão

+- Portal SAMP (https://portalsamp.com)
+-- Fórum: SA-MP (https://portalsamp.com/forumdisplay.php?fid=5)
+--- Fórum: Área de suporte (https://portalsamp.com/forumdisplay.php?fid=6)
+--- Tópico: [Pedido] Sistema De Logs (/showthread.php?tid=1636)



Sistema De Logs - Atirador-lite - 15/09/2021

Eu Sabe Se Alguma Pessoa Tem Um Sistema De Logs
Tipo Quando um admin da /ban criar um log assim: 15/09/2021 O admin Nome  Usou o comando ban no jogador Nome
ai cria o log ai eu entro no jogo e dou /logsban ai aparecer uma dialog assim  [attachment=43]  mais Com 15/09/2021 O admin Nome Usou o comando ban no jogador Nome
ou Pode Mim Ajudar A Criar




---


RE: Sistema De Logs - ipsLuan - 15/09/2021

Código PHP:
stock LerLogs(playeridfilename[]) {
    new 
readString[1000], FilelogFileGrandeBuffer[7000];

    if(!
fexist(filename)) {
        
SendAdminMessage(COLOR_YELLOWfmat_return("[LOGS] O log [%s] nao existe."filename));
        
printf("[LOGS] O log [%s] nao existe."filename);
        return 
false;
    }

    
logFile fopen(filenameio_read);
    
format(GrandeBuffersizeof(GrandeBuffer), "Exibindo os logs: \n");
    while(
fread(logFilereadString)) {
        
strcat(GrandeBufferfmat_return("%s\n"readString));
    }
    
    
ShowPlayerDialog(playeridDIALOG_NULLDIALOG_STYLE_TABLIST_HEADERSfmat_return("Log: %s"filename), GrandeBuffer"Fechar""");
    return 
1;


Código PHP:
stock EscreverLogs(filename[], text[]) {
    new 
str[256], daymonthyearhourminutesecondFilefileLog;
        
    if(!
fexist(filename)) {
        
CriarLogs(filename);
    }
        
    
gettime(hourminutesecond);
    
getdate(yearmonthday);
    
    
fileLog fopen(filenameio_append);
    
format(str sizeof(str) , "[%02i/%02i/%04i - %02i:%02i:%02i] %s\r\n" day month year hour minute second text );
    
fwrite(fileLogstr);
    
fclose(fileLog);
    return 
1;


Código PHP:
stock CriarLogs(filename[]) {
    if(
fexist(filename))
        return 
printf("[LOGS] O arquivo %s ja existe." filename);
        
    return 
fclose(fopen(filenameio_write));




RE: Sistema De Logs - Atirador-lite - 16/09/2021

(15/09/2021 18:41)ipsLuan Escreveu:
Código PHP:
stock LerLogs(playeridfilename[]) {
    new readString[1000], FilelogFileGrandeBuffer[7000];

    if(!fexist(filename)) {
        SendAdminMessage(COLOR_YELLOWfmat_return("[LOGS] O log [%s] nao existe."filename));
        printf("[LOGS] O log [%s] nao existe."filename);
        return false;
    }

    logFile fopen(filenameio_read);
    format(GrandeBuffersizeof(GrandeBuffer), "Exibindo os logs: \n");
    while(fread(logFilereadString)) {
        strcat(GrandeBufferfmat_return("%s\n"readString));
    }
    
    ShowPlayerDialog
(playeridDIALOG_NULLDIALOG_STYLE_TABLIST_HEADERSfmat_return("Log: %s"filename), GrandeBuffer"Fechar""");
    return 1;


Código PHP:
stock EscreverLogs(filename[], text[]) {
    new str[256], daymonthyearhourminutesecondFilefileLog;
        
    
if(!fexist(filename)) {
        CriarLogs(filename);
    }
        
    gettime
(hourminutesecond);
    getdate(yearmonthday);
    
    fileLog 
fopen(filenameio_append);
    format(str sizeof(str) , "[%02i/%02i/%04i - %02i:%02i:%02i] %s\r\n" day month year hour minute second text );
    fwrite(fileLogstr);
    fclose(fileLog);
    return 1;


Código PHP:
stock CriarLogs(filename[]) {
    if(fexist(filename))
        return printf("[LOGS] O arquivo %s ja existe." filename);
        
    
return fclose(fopen(filenameio_write));


vlw