SA-MP Forums Archive
[Ajuda] Ajuda com log - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Ajuda com log (/showthread.php?tid=623704)



Ajuda com log - yurin - 04.12.2016

Alguйm poderia me ajuda com esse erro no meu log? Simplesmente nгo aparece o nome de quem deu o kick
PHP код:
CMD:kick(playerid, params[])
{
    if(
pDados[playerid][Staff] >= 2)
    {
        if(
pDados[playerid][StaffTrabalhando] == 1)
        {
            new 
ID, Motivo[128];
            if(
sscanf(params, "is", ID, Motivo)) return SendClientMessage(playerid, -1, "Use: /kick [id] [motivo]");
            new 
Nome[MAX_PLAYER_NAME], string[64 + MAX_PLAYER_NAME];
            
GetPlayerName(ID, Nome, sizeof(Nome));
            
Kick(ID);
            
format(string, sizeof(string), "%s Foi kickado por %s, motivo:%s", Nome, playerid, Motivo);
            
SendClientMessageToAll(-1, string);
            
fileLog("Kicks", string);
        } else { 
SendClientMessage(playerid, -1, "Vocк precisa estб no modo trabalho!"); }
    } else { 
SendClientMessage(playerid, -1, "Vocк nгo tem permissгo para usar esse comando!"); }
    return 
1;
} 
PHP код:
stock fileLog(file[], string[])
{
    new 
time[6];
    
gettime(time[0], time[1], time[2]);
    
getdate(time[3], time[4], time[5]);
    new 
timestr[32], data[128];
    
format(timestr,32,"[%02d.%02d|%02d:%02d] ",time[5],time[4], time[0], time[1]);
    
format(data, sizeof(data), "%s%s\r\n",timestr,string);
    new 
File:hFile, thefile[32];
    
format(thefile, sizeof(thefile), "/Logs/%s.log", file);
    
hFile = fopen(thefile, io_append);
    
fwrite(hFile, data);
    
fclose(hFile);
    return 
1;
} 
Код:
[04.12|03:54] Yuri_Nogueira Foi kickado por , motivo:Text



Re: Ajuda com log - Marllun - 04.12.2016

Код:
format(string, sizeof(string), "%s Foi kickado por %s, motivo:%s", Nome, playerid, Motivo);
Playerid vai pegar o id do player se vocк quiser colocar o id tire o %s e colocar %d mas vocк que o nome nй? entгo coloque isso.

Код:
new Nome2[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nome2, sizeof(Nome2));
format(string, sizeof(string), "%s Foi kickado por %s, motivo:%s", Nome, Nome2, Motivo);



Re: Ajuda com log - SmokiieGamer - 04.12.2016

Aconselho a usar a includ Losgs.


Re: Ajuda com log - yurin - 04.12.2016

Quote:
Originally Posted by Marllun
Посмотреть сообщение
Код:
format(string, sizeof(string), "%s Foi kickado por %s, motivo:%s", Nome, playerid, Motivo);
Playerid vai pegar o id do player se vocк quiser colocar o id tire o %s e colocar %d mas vocк que o nome nй? entгo coloque isso.

Код:
new Nome2[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nome2, sizeof(Nome2));
format(string, sizeof(string), "%s Foi kickado por %s, motivo:%s", Nome, Nome2, Motivo);
Valeu!

Quote:
Originally Posted by SmokiieGamer
Посмотреть сообщение
Aconselho a usar a includ Losgs.
Й que eu quero criar um gm quase do zero, entгo sу vou usar sscanf zcmd e dof2 o resto quero eu fazer saca, claro que eu nгo estou fazendo, estou mesmo й pedindo ajuda kkkk.