Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // __________________________________________________________________
- //|____[Lords Log Sytem Lite]________________________________________|
- //| This is a system that logs all things that are said by players |
- //| that is not done with a command. |
- //| |
- //| Author: KineticNRG |
- //|__________________________________________________________________|
- //
- #include <lrp>
- //--[logs]
- forward ChatLog(string[]);
- public OnFilterScriptInit()
- {
- new str[128];
- //--[Create Logs]
- print(" ____________________________________________________");
- print("|_[Logs]_________________________________________[x]_|");
- print("|Loading Log... |");
- print("| |");
- format(str, sizeof(str), "/logs/chat.log");
- if(!fexist(str))
- {
- format(str, sizeof(str), "Chat log created.");
- ChatLog(str);
- printf("|%s Check scriptfiles/logs folder. |", str);
- }
- if(fexist(str))
- {
- print("|Chat Log Loaded. |");
- }
- print("|____________________________________________________|");
- print(" ");
- //The IsNumeric and ReturnUser are only in here to remove the error, They do nothing to the script but remove the warnings when compiling.
- new var;
- new vartxt[1];
- var = ReturnUser(vartxt);
- var = IsNumeric(vartxt);
- format(str, sizeof(str), "%d", var);
- //
- return 1;
- }
- //
- //
- public ChatLog(string[])
- {
- new str[256];
- new File:chatlog;
- chatlog = fopen("/logs/chat.log", io_append);
- new year;
- new month;
- new day;
- getdate(year, month, day);
- new hour;
- new minute;
- gettime(hour, minute);
- if(!fexist("/logs/chat.log"))
- {
- if (minute < 10)
- {
- format(str, sizeof(str), "[%d/%d/%d|%d:0%d] %s\r\n", month, day, year, hour, minute, string);
- }
- if(minute >= 10)
- {
- format(str, sizeof(str), "[%d/%d/%d|%d:%d] %s\r\n", month, day, year, hour, minute, string);
- }
- fwrite(chatlog, str);
- fclose(chatlog);
- return 1;
- }
- if (minute < 10)
- {
- format(str, sizeof(str), "[%d/%d/%d|%d:0%d] %s\r\n", month, day, year, hour, minute, string);
- }
- if(minute >= 10)
- {
- format(str, sizeof(str), "[%d/%d/%d|%d:%d] %s\r\n", month, day, year, hour, minute, string);
- }
- fwrite(chatlog, str);
- fclose(chatlog);
- return 1;
- }
- //
- //
- public OnPlayerText(playerid, text[])
- {
- ChatLog(text);// anything that is typed that is not a command is logged here with this in the chat.log file.
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement