SA-MP Forums Archive
InGame Chat log. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: InGame Chat log. (/showthread.php?tid=442677)



InGame Chat log. - kepa333 - 08.06.2013

Well i made function wich will show me chat log ingame, but ingame its show only first line, i want it to show last 100 lines.


Код HTML:
forward ReadChatLog(playerid);
public ReadChatLog(playerid)
{
    new string[64]; 
    new File:example = fopen("Logs/chat.log", io_read); 
    fread(example, string, 15000);
    fclose(example); 
	SendClientMessage(playerid, COLOR_GREEN, "CHAT LOGs:");
	SendClientMessage(playerid, COLOR_GREEN, string);
    return 1;
}

if(strcmp(cmd, "/ccl", true) == 0)
{
    if(PlayerInfo[playerid][pAdmin] >= 5)
    {
        ReadChatLog(playerid);
    }
    else
    {
        SendClientMessage(playerid, COLOR_GRAD1, "** You are not an admin!");
    }
    return 1;
}



Re: InGame Chat log. - kepa333 - 08.06.2013

bump


Re: InGame Chat log. - DobbysGamertag - 08.06.2013

Try increasing the string, or add a new line "%s\n%\n


Re: InGame Chat log. - random123 - 08.06.2013

PHP код:
#define MAX_LINES_SENT  20//we do this incase the log has 200 lines in it, you wouldn't want your screen spammed with 200 lines of chat would you?
forward ReadChatLog (playerid);
public 
ReadChatLog (playerid)
{
    new 
string [128],Fileexample fopen ("Logs / chat.log"io_read); 
    
    while(
fread(examplestring))
    {
        
        
line ++;
        
SendClientMessage (playeridCOLOR_GREEN"CHAT LOGs:");
    
SendClientMessage (playeridCOLOR_GREENstring);
        if(
line >= MAX_LINES_SENT)
        {
            break;
        }
    }
    
fclose(example);
    return 
1;

This hasn't been tested and may not compile(due to typos) . if this compiles but doesn't work be sure that you are adding \n at the end of the string in function that actually writes the log.


Re: InGame Chat log. - kepa333 - 10.06.2013

Thanks will try it.


Re: InGame Chat log. - kepa333 - 10.06.2013

Every thing works greate expect, when i do /ccl its read only first lines ( old one ) i want it to read last 25 files


Re: InGame Chat log. - kepa333 - 12.06.2013

bump.


Re: InGame Chat log. - kepa333 - 13.06.2013

bump


Re: InGame Chat log. - DarkPower010 - 13.06.2013

is it because the command ccl?

i only make the commands.. [You Need ZCMD To Make This CMD Work]

pawn Код:
CMD:ccl(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 5)
    {
        ReadChatLog(playerid);
    }
    else
    {
        SendClientMessage(playerid, COLOR_GRAD1, "** You are not an admin!");
    }
    return 1;
}