Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- NAME: kLog
- DESC: Log System
- AUTHOR: Orel Lazri (oKzrh)
- SKYPE: iferox2
- EMAIL: [email protected]
- */
- //--------------- INCLUDES ---------------
- #include <a_samp>
- //--------------- DEFINES ----------------
- // Comment those lines below to disable them
- #define ADMIN_LOG 1 // Also log admin text and commands
- #define ADMIN_LOG_CHAT 1 // When each log is written, admins can also see it
- //--------------- PUBLICS ----------------
- public OnPlayerText(playerid, text[]) {
- #if ADMIN_LOG
- WriteLog(playerid, text);
- #else
- if (!IsPlayerAdmin(playerid))
- WriteLog(playerid, text);
- #endif
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[]) {
- #if ADMIN_LOG
- WriteLog(playerid, cmdtext);
- #else
- if (!IsPlayerAdmin(playerid))
- WriteLog(playerid, cmdtext);
- #endif
- return 0;
- }
- //--------------- STOCKS -----------------
- stock GN(playerid) {
- new pname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pname, sizeof(pname));
- return pname;
- }
- stock WriteLog(playerid, text[]) {
- new str[140], time[3], File:log = fopen("klog.txt", io_append);
- gettime(time[0], time[1], time[2]);
- format(str, sizeof(str), "[%d:%d:%d] %s: %s\r\n", time[0], time[1], time[2], GN(playerid), text);
- fwrite(log, str);
- fclose(log);
- #if defined ADMIN_LOG_CHAT
- for (new i = 0; i < MAX_PLAYERS; i++) {
- if (IsPlayerConnected(i) && IsPlayerAdmin(i) && playerid != i)
- SendClientMessage(i, 0x757575AA, str);
- }
- #endif
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment