SA-MP Forums Archive
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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Chat Log? (/showthread.php?tid=238993)



Chat Log? - sciman001 - 12.03.2011

Ok, i just made a super basic chat log. The code is pretty decent. BUT, i get this error:

F:\dmserver\filterscripts\chatlog.pwn(20) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.

CODE:

pawn Код:
#include <a_samp>
#include <file>
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
    print("CHATLOG");
    return 1;
}

#else
main()
{
    print("Made BY: MATT");
}

#endif
public OnPlayerText(playerid, text[])
{
new File:chatlog = fopen("/logs/ChatLog.txt",io_append),chat[128],chater[128],hour,minute,second;
    GetPlayerName(playerid,chater,sizeof(chater));
    gettime(hour,minute,second);
    format(chat,sizeof(chat),"[%d:%d:%d]: ( %s ): %s\n",hour,minute,second,chater,text);
    if(chatlog)
    {
        if(fexist("chatlog.txt"))
        {
            fwrite(chatlog,chat);
            fclose(chatlog);
        }
    }
    return 1;
}
What should i do


Re: Chat Log? - admantis - 12.03.2011

Please use [ pawn ] [ /pawn ] tags so we can read the code and know which line is wrongly idented.


Re: Chat Log? - sciman001 - 12.03.2011

done


Re: Chat Log? - admantis - 12.03.2011

It's very obvious.
pawn Код:
new File:chatlog = fopen("/logs/ChatLog.txt",io_append),chat[128],chater[128],hour,minute,second;
It's unidented, add a tab space to it.


Re: Chat Log? - sciman001 - 12.03.2011

ok. ill try that. fixed it! THANK YOU SOOOOOOOOO MUCH!!!!!!!!!!!!!!!!!!!!!!!


Re: Chat Log? - sciman001 - 12.03.2011

ok, now it wont write to the file. i ut it in my gamemode. do i need #include <file> or something? WHAT TO DO


Re: Chat Log? - sciman001 - 12.03.2011

it will create the file and stuff. it just wont write to it. WHAT TO DO??


Re: Chat Log? - grand.Theft.Otto - 12.03.2011

Why make a chat log when you already have a server_log.txt when samp-server.exe starts?


Re: Chat Log? - sciman001 - 12.03.2011

because the server log is filled with a bunch of other stuff. plus i want to learn more about scripting.


Re: Chat Log? - admantis - 12.03.2011

Of course you've put that code from a tutorial which is bad implemented, there are others tutorials to make chatlogs tho. I can't help you now because I don't use SA-MP's file include.


Re: Chat Log? - sciman001 - 12.03.2011

so what should i do? how can i do this in dini?