Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Log Filterscript by [Bios]Marcel
- //INCLUDES
- #include <a_samp>
- #include <Directory>
- #include <Dini>
- #include <a_http>
- #include <zcmd>
- #include <sscanf2>
- //PUBLIC VARIABLES
- new VERSION[8] = "1.3.0.4"; //DO NOT CHANGE THIS, IT TELLS U IF THERE IS A NEWER VERSION!
- new
- savetime = 0,
- PositionLogging,
- ChatLogging,
- CommandLogging,
- ShootingLogging,
- DeathLogging,
- ConnectLogging,
- DisconnectLogging,
- InteriorLogging,
- RconLoginLogging,
- CarEnterLogging,
- CarExitLogging,
- RconCommandLogging,
- SaveMode,
- Timer[MAX_PLAYERS],
- gPath[70],
- File[16]="Logs/Config.cfg";
- //DEFINES
- #define LOGMENU 1
- #define LOGCONFIG 2
- #define SAVEMODE2_CHOOSEPLAYER 3
- #define SAVEMODE3_CLEAN 4
- #define SAVEMODE4_CHOOSE 5
- #define S4_CLEAN_POSITION 6
- #define S4_CLEAN_CHAT 7
- #define S4_CLEAN_COMMAND 8
- #define S4_CLEAN_SHOOTING 9
- #define S4_CLEAN_DEATH 10
- #define S4_CLEAN_CONNECT 11
- #define S4_CLEAN_DISCONNECT 12
- #define S4_CLEAN_INTERIOR 13
- #define S4_CLEAN_RCONLOGIN 14
- #define S4_CLEAN_CARENTER 15
- #define S4_CLEAN_CAREXIT 16
- #define S4_CLEAN_RCONCOMMAND 17
- #define POSLOGINT 18
- #define SAVEMODE1_CHOOSEPLAYER 19
- #define SAVEMODE1_CHOOSELOG 20
- #define CULPRIT 1
- #define VICTIM 2
- //PUBLICS (default)
- public OnFilterScriptInit()
- {
- printf("[Logging System] Log Filterscript loaded.");
- checkVersion();
- DirCreate("Logs");
- if(fexist("Logs/LogConfig.cfg"))
- {
- dini_Create(File);
- dini_IntSet(File,"PositionLogging",dini_Int("Logs/LogConfig.cfg","PositionLogging"));
- dini_IntSet(File,"ChatLogging",dini_Int("Logs/LogConfig.cfg","ChatLogging"));
- dini_IntSet(File,"CommandLogging",dini_Int("Logs/LogConfig.cfg","CommandLogging"));
- dini_IntSet(File,"ShootingLogging",dini_Int("Logs/LogConfig.cfg","ShootingLogging"));
- dini_IntSet(File,"DeathLogging",dini_Int("Logs/LogConfig.cfg","DeathLogging"));
- dini_IntSet(File,"ConnectLogging",dini_Int("Logs/LogConfig.cfg","ConnectLogging"));
- dini_IntSet(File,"DisconnectLogging",dini_Int("Logs/LogConfig.cfg","DisconnectLogging"));
- dini_IntSet(File,"InteriorLogging",dini_Int("Logs/LogConfig.cfg","InteriorLogging"));
- dini_IntSet(File,"RconLoginLogging",dini_Int("Logs/LogConfig.cfg","RconLoginLogging"));
- dini_IntSet(File,"CarEnterLogging",dini_Int("Logs/LogConfig.cfg","CarEnterLogging"));
- dini_IntSet(File,"CarExitLogging",dini_Int("Logs/LogConfig.cfg","CarExitLogging"));
- dini_IntSet(File,"RconCommandLogging",dini_Int("Logs/LogConfig.cfg","RconCommandLogging"));
- dini_IntSet(File,"SaveMode",dini_Int("Logs/LogConfig.cfg","SaveMode"));
- dini_Set(File,"LogFilesPerX","no");
- dini_IntSet(File,"PositionLogInterval",dini_Int("Logs/LogConfig.cfg","PositionLogInterval"));
- }
- if(dini_Create(File))
- {
- dini_IntSet(File,"PositionLogging",1);
- dini_IntSet(File,"ChatLogging",1);
- dini_IntSet(File,"CommandLogging",1);
- dini_IntSet(File,"ShootingLogging",1);
- dini_IntSet(File,"DeathLogging",1);
- dini_IntSet(File,"ConnectLogging",1);
- dini_IntSet(File,"DisconnectLogging",1);
- dini_IntSet(File,"InteriorLogging",1);
- dini_IntSet(File,"RconLoginLogging",1);
- dini_IntSet(File,"CarEnterLogging",1);
- dini_IntSet(File,"CarExitLogging",1);
- dini_IntSet(File,"RconCommandLogging",1);
- dini_IntSet(File,"SaveMode",1);
- dini_Set(File,"LogFilesPerX","no");
- dini_IntSet(File,"PositionLogInterval",1500);
- }
- LoadCFG();
- if((SaveMode > 4) || (SaveMode < 1))
- {
- dini_IntSet(File,"SaveMode",1);
- print("[Logging System]The SaveMode was automatically set to 1 since it wasn't in range of 1 and 4.");
- }
- if(SaveMode == 4)
- {
- dini_Create("Logs/Chat.log");
- dini_Create("Logs/Command.log");
- dini_Create("Logs/Connect.log");
- dini_Create("Logs/Death.log");
- dini_Create("Logs/Disconnect.log");
- dini_Create("Logs/Interior.log");
- dini_Create("Logs/CarEnter.log");
- dini_Create("Logs/CarExit.log");
- dini_Create("Logs/Shooting.log");
- dini_Create("Logs/RconLogin.log");
- dini_Create("Logs/Position.log");
- }
- if(RconCommandLogging)
- {
- if(SaveMode != 3)
- {
- dini_Create("Logs/RconCommand.log");
- }
- }
- return 1;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- if(RconLoginLogging)
- {
- new IP[16];
- if(!success)
- {
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- GetPlayerIp(i, IP, 16);
- if(!strcmp(ip, IP, true))
- {
- RconAttemptLog(i,false,ip,password);
- break;
- }
- }
- }
- else
- {
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- GetPlayerIp(i, IP, 16);
- if(!strcmp(ip, IP, true))
- {
- RconAttemptLog(i,true,ip,password);
- break;
- }
- }
- }
- }
- return 1;
- }
- public OnRconCommand(cmd[])
- {
- RCommand(cmd);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- if(PositionLogging)
- {
- Timer[playerid] = SetTimerEx("LogLoc",dini_Int(File,"PosiotionLogInterval"),true,"i",playerid);
- }
- return 1;
- }
- public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
- {
- if(ShootingLogging)
- {
- ShootingLog(playerid,issuerid,amount,weaponid,CULPRIT);
- ShootingLog(issuerid,playerid,amount,weaponid,VICTIM);
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- if(SaveMode == 1)
- {
- new path[80];
- format(path,80,"Logs/%s",getName(playerid));
- DirCreate(path);
- }
- else if(SaveMode == 2)
- {
- new path[80];
- format(path,80,"Logs/%s.log",getName(playerid));
- dini_Create(path);
- }
- if(ConnectLogging)
- {
- ConnectLog(playerid);
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(DisconnectLogging)
- {
- DisconnectLog(playerid, reason);
- }
- KillTimer(Timer[playerid]);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(DeathLogging)
- {
- if(killerid != INVALID_PLAYER_ID)
- {
- DeathLog(playerid,killerid,reason,VICTIM);
- DeathLog(killerid,playerid,reason,CULPRIT);
- }
- else
- {
- DeathLog(playerid,-1,reason,0);
- }
- }
- }
- public OnPlayerText(playerid, text[])
- {
- if(ChatLogging)
- {
- ChatLog(playerid, text);
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(CommandLogging)
- {
- CommandLog(playerid, cmdtext);
- }
- return 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- if(CarEnterLogging)
- {
- SetTimerEx("LogCar",3000,false,"i",playerid);
- }
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- if(CarExitLogging)
- {
- OutLog(playerid,GetPlayerVehicleSeat(playerid),vehicleid,GetVehicleModel(vehicleid));
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == LOGMENU)
- {
- if(response)
- {
- if(listitem == 0)
- {
- Log_Config(playerid);
- }
- else
- {
- if(savetime != 0)
- {
- Log_Config(playerid);
- }
- else
- {
- SendClientMessage(playerid,-1,"[Logging System] You can't use this function since you are using the function to save logfiles hourly/daily/monthly/yearly.CreateActor (Will be added in alter patches)");
- }
- }
- }
- }
- else if(dialogid == SAVEMODE1_CHOOSEPLAYER)
- {
- if(response)
- {
- new path[70];
- format(path,70,"Logs/%s",inputtext);
- if(CheckPath(path))
- {
- gPath = path;
- ShowPlayerDialog(playerid,SAVEMODE1_CHOOSELOG,DIALOG_STYLE_LIST,"Log clean (Step 2)","Position log\nChat log\nCommand log\nShooting log\nDeath log\nConnect log\nDisconnect log\nInterior log\n Rcon login log\nCarEnter log\nCarExit log","Confirm","Back");
- }
- }
- else
- {
- Log_Clean(playerid);
- }
- }
- else if(dialogid == SAVEMODE1_CHOOSELOG)
- {
- if(response)
- {
- new path[75];
- if(listitem == 0)
- {
- format(path,75,"%s/Position.log",gPath);
- fremove(path);
- dini_Create(path);
- }
- else if(listitem == 1)
- {
- format(path,75,"%s/Chat.log",gPath);
- fremove(path);
- dini_Create(path);
- }
- else if(listitem == 2)
- {
- format(path,75,"%s/Command.log",gPath);
- fremove(path);
- dini_Create(path);
- }
- else if(listitem == 3)
- {
- format(path,75,"%s/Shooting.log",gPath);
- fremove(path);
- dini_Create(path);
- }
- else if(listitem == 4)
- {
- format(path,75,"%s/Death.log",gPath);
- fremove(path);
- dini_Create(path);
- }
- else if(listitem == 5)
- {
- format(path,75,"%s/Connect.log",gPath);
- fremove(path);
- dini_Create(path);
- }
- else if(listitem == 6)
- {
- format(path,75,"%s/Disconnecct.log",gPath);
- fremove(path);
- dini_Create(path);
- }
- else if(listitem == 7)
- {
- format(path,75,"%s/Interior.log",gPath);
- fremove(path);
- dini_Create(path);
- }
- else if(listitem == 8)
- {
- format(path,75,"%s/RconLogin.log",gPath);
- fremove(path);
- dini_Create(path);
- }
- else if(listitem == 9)
- {
- format(path,75,"%s/CarEnter.log",gPath);
- fremove(path);
- dini_Create(path);
- }
- else if(listitem == 10)
- {
- format(path,75,"%s/CarExit.log",gPath);
- fremove(path);
- dini_Create(path);
- }
- }
- else
- {
- ShowPlayerDialog(playerid,SAVEMODE1_CHOOSEPLAYER,DIALOG_STYLE_INPUT,"Log clean","Choose a player to delete his logfiles(You will choose the specific log afterwards)","Confirm","Back");
- }
- }
- else if(dialogid == SAVEMODE2_CHOOSEPLAYER)
- {
- if(response)
- {
- new path[70];
- format(path,70,"Logs/%s.log",inputtext);
- if(!fexist(path))
- {
- ShowPlayerDialog(playerid,SAVEMODE2_CHOOSEPLAYER,DIALOG_STYLE_INPUT,"Log clean","Which Player File should be cleaned?\n(The Full Playername not PlayerID)","Confirm","Back");
- GameTextForPlayer(playerid,"Invalid Playername! (Watch out for case sensitive)",3000,5);
- }
- else
- {
- fremove(path);
- dini_Create(path);
- new string2[70];
- format(string2,70,"%s's Log was cleaned successful.",inputtext);
- GameTextForPlayer(playerid,string2,3000,5);
- ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
- }
- }
- else
- {
- ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
- }
- }
- else if(dialogid == SAVEMODE3_CLEAN)
- {
- if(response)
- {
- fremove("Logs/Log.log");
- dini_Create("Logs/Log.log");
- GameTextForPlayer(playerid,"log cleaned successful.",3000,5);
- ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
- }
- else
- {
- ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
- }
- }
- else if(dialogid == S4_CLEAN_CHAT)
- {
- if(response)
- {
- fremove("Logs/Chat.log");
- dini_Create("Logs/Chat.log");
- GameTextForPlayer(playerid,"Chat log cleaned successful.",3000,5);
- ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
- }
- else
- {
- getLogSizes(playerid);
- }
- }
- else if(dialogid == S4_CLEAN_COMMAND)
- {
- if(response)
- {
- fremove("Logs/Command.log");
- dini_Create("Logs/Command.log");
- GameTextForPlayer(playerid,"Command log cleaned successful.",3000,5);
- ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
- }
- else
- {
- getLogSizes(playerid);
- }
- }
- else if(dialogid == S4_CLEAN_SHOOTING)
- {
- if(response)
- {
- fremove("Logs/Shooting.log");
- dini_Create("Logs/Shooting.log");
- GameTextForPlayer(playerid,"Shooting log cleaned successful.",3000,5);
- ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
- }
- else
- {
- getLogSizes(playerid);
- }
- }
- else if(dialogid == S4_CLEAN_DEATH)
- {
- if(response)
- {
- fremove("Logs/Death.log");
- dini_Create("Logs/Death.log");
- GameTextForPlayer(playerid,"Death log cleaned successful.",3000,5);
- ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
- }
- else
- {
- getLogSizes(playerid);
- }
- }
- else if(dialogid == S4_CLEAN_CONNECT)
- {
- if(response)
- {
- fremove("Logs/Connect.log");
- dini_Create("Logs/Connect.log");
- GameTextForPlayer(playerid,"Connect log cleaned successful.",3000,5);
- ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
- }
- else
- {
- getLogSizes(playerid);
- }
- }
- else if(dialogid == S4_CLEAN_DISCONNECT)
- {
- if(response)
- {
- fremove("Logs/Disconnect.log");
- dini_Create("Logs/Disconnect.log");
- GameTextForPlayer(playerid,"Disconnect log cleaned successful.",3000,5);
- ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
- }
- else
- {
- getLogSizes(playerid);
- }
- }
- else if(dialogid == S4_CLEAN_POSITION)
- {
- if(response)
- {
- fremove("Logs/Position.log");
- dini_Create("Logs/Position.log");
- GameTextForPlayer(playerid,"Interior log cleaned successful.",3000,5);
- ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
- }
- else
- {
- getLogSizes(playerid);
- }
- }
- else if(dialogid == S4_CLEAN_INTERIOR)
- {
- if(response)
- {
- fremove("Logs/Interior.log");
- dini_Create("Logs/Interior.log");
- GameTextForPlayer(playerid,"Interior log cleaned successful.",3000,5);
- ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
- }
- else
- {
- getLogSizes(playerid);
- }
- }
- else if(dialogid == S4_CLEAN_RCONLOGIN)
- {
- if(response)
- {
- fremove("Logs/RconLogin.log");
- dini_Create("Logs/RconLogin.log");
- GameTextForPlayer(playerid,"RconLogin log cleaned successful.",3000,5);
- ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
- }
- else
- {
- getLogSizes(playerid);
- }
- }
- else if(dialogid == S4_CLEAN_CARENTER)
- {
- if(response)
- {
- fremove("Logs/CarEnter.log");
- dini_Create("Logs/CarEnter.log");
- GameTextForPlayer(playerid,"CarEnter log cleaned successful.",3000,5);
- ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
- }
- else
- {
- getLogSizes(playerid);
- }
- }
- else if(dialogid == S4_CLEAN_CAREXIT)
- {
- if(response)
- {
- fremove("Logs/CarExit.log");
- dini_Create("Logs/CarExit.log");
- GameTextForPlayer(playerid,"CarExit log cleaned successful.",3000,5);
- ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
- }
- else
- {
- getLogSizes(playerid);
- }
- }
- else if(dialogid == S4_CLEAN_RCONCOMMAND)
- {
- if(response)
- {
- fremove("Logs/RconCommand.log");
- dini_Create("Logs/RconCommand.log");
- GameTextForPlayer(playerid,"RconCommand log cleaned successful.",3000,5);
- ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
- }
- else
- {
- getLogSizes(playerid);
- }
- }
- else if(dialogid == SAVEMODE4_CHOOSE)
- {
- if(response)
- {
- if(listitem == 0)
- {
- cleanLog(playerid,0);
- }
- else if(listitem == 1)
- {
- cleanLog(playerid,1);
- }
- else if(listitem == 2)
- {
- cleanLog(playerid,2);
- }
- else if(listitem == 3)
- {
- cleanLog(playerid,3);
- }
- else if(listitem == 4)
- {
- cleanLog(playerid,4);
- }
- else if(listitem == 5)
- {
- cleanLog(playerid,5);
- }
- else if(listitem == 6)
- {
- cleanLog(playerid,6);
- }
- else if(listitem == 7)
- {
- cleanLog(playerid,7);
- }
- else if(listitem == 8)
- {
- cleanLog(playerid,8);
- }
- else if(listitem == 9)
- {
- cleanLog(playerid,9);
- }
- else if(listitem == 10)
- {
- cleanLog(playerid,10);
- }
- else
- {
- cleanLog(playerid,11);
- }
- }
- }
- else if(dialogid == LOGCONFIG)
- {
- if(response)
- {
- if(listitem == 0)
- {
- if(PositionLogging)
- {
- PositionLogging = 0;
- dini_IntSet(File,"PositionLogging",0);
- Log_Config(playerid);
- }
- else
- {
- PositionLogging = 1;
- dini_IntSet(File,"PositionLogging",1);
- Log_Config(playerid);
- }
- }
- else if(listitem == 1)
- {
- if(ChatLogging)
- {
- ChatLogging = 0;
- dini_IntSet(File,"ChatLogging",0);
- Log_Config(playerid);
- }
- else
- {
- ChatLogging = 1;
- dini_IntSet(File,"ChatLogging",1);
- Log_Config(playerid);
- }
- }
- else if(listitem == 2)
- {
- if(CommandLogging)
- {
- CommandLogging = 0;
- dini_IntSet(File,"CommandLogging",0);
- Log_Config(playerid);
- }
- else
- {
- CommandLogging = 1;
- dini_IntSet(File,"CommandLogging",1);
- Log_Config(playerid);
- }
- }
- else if(listitem == 3)
- {
- if(ShootingLogging)
- {
- ShootingLogging = 0;
- dini_IntSet(File,"ShootingLogging",0);
- Log_Config(playerid);
- }
- else
- {
- ShootingLogging = 1;
- dini_IntSet(File,"ShootingLogging",1);
- Log_Config(playerid);
- }
- }
- else if(listitem == 4)
- {
- if(DeathLogging)
- {
- DeathLogging = 0;
- dini_IntSet(File,"DeathLogging",0);
- Log_Config(playerid);
- }
- else
- {
- DeathLogging = 1;
- dini_IntSet(File,"DeathLogging",1);
- Log_Config(playerid);
- }
- }
- else if(listitem == 5)
- {
- if(ConnectLogging)
- {
- ConnectLogging = 0;
- dini_IntSet(File,"ConnectLogging",0);
- Log_Config(playerid);
- }
- else
- {
- ConnectLogging = 1;
- dini_IntSet(File,"ConnectLogging",1);
- Log_Config(playerid);
- }
- }
- else if(listitem == 6)
- {
- if(DisconnectLogging)
- {
- DisconnectLogging = 0;
- dini_IntSet(File,"DisconnectLogging",0);
- Log_Config(playerid);
- }
- else
- {
- DisconnectLogging = 1;
- dini_IntSet(File,"DisconnectLogging",1);
- Log_Config(playerid);
- }
- }
- else if(listitem == 7)
- {
- if(InteriorLogging)
- {
- InteriorLogging = 0;
- dini_IntSet(File,"InteriorLogging",0);
- Log_Config(playerid);
- }
- else
- {
- InteriorLogging = 1;
- dini_IntSet(File,"InteriorLogging",1);
- Log_Config(playerid);
- }
- }
- else if(listitem == 8)
- {
- if(RconLoginLogging)
- {
- RconLoginLogging = 0;
- dini_IntSet(File,"RconLoginLogging",0);
- Log_Config(playerid);
- }
- else
- {
- RconLoginLogging = 1;
- dini_IntSet(File,"RconLoginLogging",1);
- Log_Config(playerid);
- }
- }
- else if(listitem == 9)
- {
- if(CarEnterLogging)
- {
- CarEnterLogging = 0;
- dini_IntSet(File,"CarEnterLogging",0);
- Log_Config(playerid);
- }
- else
- {
- CarEnterLogging = 1;
- dini_IntSet(File,"CarEnterLogging",1);
- Log_Config(playerid);
- }
- }
- else if(listitem == 10)
- {
- if(CarExitLogging)
- {
- CarExitLogging = 0;
- dini_IntSet(File,"CarExitLogging",0);
- Log_Config(playerid);
- }
- else
- {
- CarExitLogging = 1;
- dini_IntSet(File,"CarExitLogging",1);
- Log_Config(playerid);
- }
- }
- else if(listitem == 11)
- {
- if(RconCommandLogging)
- {
- RconCommandLogging = 0;
- dini_IntSet(File,"RconCommandLogging",0);
- Log_Config(playerid);
- }
- else
- {
- RconCommandLogging = 1;
- dini_IntSet(File,"RconCommandLogging",1);
- Log_Config(playerid);
- }
- }
- else if(listitem == 12)
- {
- SaveMode++;
- if(SaveMode == 5)
- {
- SaveMode = 1;
- }
- dini_IntSet(File,"SaveMode",SaveMode);
- Log_Config(playerid);
- }
- else if(listitem == 13)
- {
- if(SaveMode == 1)
- savetime++;
- if(savetime == 5)
- {
- savetime = 0;
- }
- dini_IntSet(File,"LogFilesPerX",savetime);
- Log_Config(playerid);
- }
- else if(listitem == 14)
- {
- ShowPlayerDialog(playerid,POSLOGINT,DIALOG_STYLE_INPUT,"Position Log Interval","Enter a Interval for the player position logging.\nIf u enter a too low interval it may cause problems.\nThe format is milliseconds.","Select","Back");
- }
- else if(listitem == 16)
- {
- PositionLogging = 0;
- dini_IntSet(File,"PositionLogging",0);
- ChatLogging = 0;
- dini_IntSet(File,"ChatLogging",0);
- ConnectLogging = 0;
- dini_IntSet(File,"ConnectLogging",0);
- DisconnectLogging = 0;
- dini_IntSet(File,"DisconnectLogging",0);
- ShootingLogging = 0;
- dini_IntSet(File,"ShootingLogging",0);
- DeathLogging = 0;
- dini_IntSet(File,"DeathLogging",0);
- RconLoginLogging = 0;
- dini_IntSet(File,"RconLoginLogging",0);
- InteriorLogging = 0;
- dini_IntSet(File,"InteriorLogging",0);
- CarEnterLogging = 0;
- dini_IntSet(File,"CarEnterLogging",0);
- CarExitLogging = 0;
- dini_IntSet(File,"CarExitLogging",0);
- CommandLogging = 0;
- dini_IntSet(File,"CommandLogging",0);
- RconCommandLogging = 0;
- dini_IntSet(File,"RconCommandLogging",0);
- Log_Config(playerid);
- }
- else if(listitem == 17)
- {
- PositionLogging = 1;
- dini_IntSet(File,"PositionLogging",1);
- ChatLogging = 1;
- dini_IntSet(File,"ChatLogging",1);
- ConnectLogging = 1;
- dini_IntSet(File,"ConnectLogging",1);
- DisconnectLogging = 1;
- dini_IntSet(File,"DisconnectLogging",1);
- ShootingLogging = 1;
- dini_IntSet(File,"ShootingLogging",1);
- DeathLogging = 1;
- dini_IntSet(File,"DeathLogging",1);
- RconLoginLogging = 1;
- dini_IntSet(File,"RconLoginLogging",1);
- InteriorLogging = 1;
- dini_IntSet(File,"InteriorLogging",1);
- CarEnterLogging = 1;
- dini_IntSet(File,"CarEnterLogging",1);
- CarExitLogging = 1;
- dini_IntSet(File,"CarExitLogging",1);
- CommandLogging = 1;
- dini_IntSet(File,"CommandLogging",1);
- RconCommandLogging = 1;
- dini_IntSet(File,"RconCommandLogging",1);
- Log_Config(playerid);
- }
- }
- }
- else if(dialogid == POSLOGINT)
- {
- if(response)
- {
- if(isNumeric(inputtext))
- {
- dini_IntSet(File,"PositionLogInterval",strval(inputtext));
- } else {
- ShowPlayerDialog(playerid,POSLOGINT,DIALOG_STYLE_INPUT,"Position Log Interval","The text that u entered was no number.\n\nEnter a Interval for the player position logging.\nIf u enter a too low interval it may cause problems.\nThe format is milliseconds.","Select","Back");
- }
- }
- else
- {
- Log_Config(playerid);
- }
- }
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- if(InteriorLogging)
- {
- InteriorLog(playerid,newinteriorid,oldinteriorid);
- }
- return 1;
- }
- //STOCKS
- stock checkVersion()
- {
- HTTP(1,HTTP_GET,"dl.dropboxusercontent.com/u/89362253/versions/samplog/version.txt","","MyHttpResponse");
- }
- stock LoadCFG()
- {
- PositionLogging = dini_Int(File,"PositionLogging");
- ChatLogging = dini_Int(File,"ChatLogging");
- CommandLogging = dini_Int(File,"CommandLogging");
- ShootingLogging = dini_Int(File,"ShootingLogging");
- DeathLogging = dini_Int(File,"DeathLogging");
- ConnectLogging = dini_Int(File,"ConnectLogging");
- DisconnectLogging = dini_Int(File,"DisconnectLogging");
- InteriorLogging = dini_Int(File,"InteriorLogging");
- RconLoginLogging = dini_Int(File,"RconLoginLogging");
- CarEnterLogging = dini_Int(File,"CarEnterLogging");
- CarExitLogging = dini_Int(File,"CarExitLogging");
- RconCommandLogging = dini_Int(File,"RconCommandLogging");
- SaveMode = dini_Int(File,"SaveMode");
- savetime = dini_Int(File,"LogFilesPerX");
- return 1;
- }
- stock getDateAndTime()
- {
- new fyear, fmonth, fday,
- fhour, fminute, fsecond,date[32];
- getdate(fyear, fmonth, fday);
- gettime(fhour, fminute, fsecond);
- format(date, 32,"[%02d/%02d/%04d %02d:%02d:%02d]", fday, fmonth, fyear, fhour, fminute, fsecond);
- return date;
- }
- stock getTimeInfo()
- {
- new fyear, fmonth, fday,
- fhour, date[32];
- getdate(fyear, fmonth, fday);
- gettime(fhour);
- switch(savetime)
- {
- case 0: date = "";
- case 1: format(date, 32,"-%02d-%02d-%04d_%02d", fday, fmonth, fyear, fhour);
- case 2: format(date, 32,"-%02d-%02d-%04d", fday, fmonth, fyear);
- case 3: format(date, 32,"-%02d-%04d", fmonth, fyear);
- case 4: format(date, 32,"-%04d", fyear);
- }
- return date;
- }
- stock isNumeric(const string[])
- {
- for (new i = 0, j = strlen(string); i < j; i++)
- {
- if (string[i] > '9' || string[i] < '0') return 0;
- }
- return 1;
- }
- stock getName(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,MAX_PLAYER_NAME);
- return name;
- }
- stock ChatLog(playerid, text[])
- {
- new path[80];
- switch(SaveMode)
- {
- case 1: format(path,80,"Logs/%s/Chat%s.log",getName(playerid),getTimeInfo());
- case 2: format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
- case 3: format(path,80,"Logs/Log%s.log",getTimeInfo());
- case 4: format(path,80,"Logs/Chat%s.log",getTimeInfo());
- }
- new
- File:lFile = fopen(path, io_append),
- logData[220];
- format(logData, 220,"%s %s: %s \r\n", getDateAndTime(), getName(playerid), text);
- fwrite(lFile, logData);
- fclose(lFile);
- return 1;
- }
- stock ConnectLog(playerid)
- {
- new path[80];
- switch(SaveMode)
- {
- case 1: format(path,80,"Logs/%s/Connect%s.log",getName(playerid),getTimeInfo());
- case 2: format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
- case 3: format(path,80,"Logs/Log%s.log",getTimeInfo());
- case 4: format(path,80,"Logs/Connect%s.log",getTimeInfo());
- }
- new
- File:lFile = fopen(path, io_append),
- logData[100],ip[16];
- GetPlayerIp(playerid,ip,16);
- format(logData, 100,"%s %s connected with IP: %s \r\n",getDateAndTime(), getName(playerid), ip);
- fwrite(lFile, logData);
- fclose(lFile);
- return 1;
- }
- stock DisconnectLog(playerid, reason)
- {
- new path[80];
- switch(SaveMode)
- {
- case 1: format(path,80,"Logs/%s/Disconnect%s.log",getName(playerid),getTimeInfo());
- case 2: format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
- case 3: format(path,80,"Logs/Log%s.log",getTimeInfo());
- case 4: format(path,80,"Logs/Disconnect%s.log",getTimeInfo());
- }
- new
- File:lFile = fopen(path, io_append),
- logData[100],ip[16],string[14];
- GetPlayerIp(playerid,ip,16);
- switch(reason)
- {
- case 0: string = "Timed out";
- case 1: string = "Leaving";
- case 2: string = "Kicked/Banned";
- }
- format(logData, 100,"%s %s (IP:%s) disconnected, reason: %s \r\n", getDateAndTime(), getName(playerid), ip, string);
- fwrite(lFile, logData);
- fclose(lFile);
- return 1;
- }
- stock CommandLog(playerid, cmdtext[])
- {
- new path[80];
- switch(SaveMode)
- {
- case 1: format(path,80,"Logs/%s/Command%s.log",getName(playerid),getTimeInfo());
- case 2: format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
- case 3: format(path,80,"Logs/Log%s.log",getTimeInfo());
- case 4: format(path,80,"Logs/Command%s.log",getTimeInfo());
- }
- new
- File:lFile = fopen(path, io_append),
- logData[200];
- format(logData, 200,"%s %s: %s \r\n", getDateAndTime(), getName(playerid), cmdtext);
- fwrite(lFile, logData);
- fclose(lFile);
- return 1;
- }
- stock DeathLog(playerid,killerid,reason,victimcase)
- {
- new path[80];
- switch(SaveMode)
- {
- case 1: format(path,80,"Logs/%s/Death%s.log",getName(playerid),getTimeInfo());
- case 2: format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
- case 3: format(path,80,"Logs/Log%s.log",getTimeInfo());
- case 4: format(path,80,"Logs/Death%s.log",getTimeInfo());
- }
- new
- File:lFile = fopen(path, io_append),
- logData[200];
- if(killerid != INVALID_PLAYER_ID)
- {
- if(victimcase == VICTIM)
- {
- format(logData, 200,"%s %s was killed by: %s, weapon: %s \r\n", getDateAndTime(), getName(playerid), getName(killerid), reason);
- }
- else if(victimcase == CULPRIT)
- {
- format(logData, 200,"%s %s has killed %s, weapon: %s \r\n",getDateAndTime(), getName(killerid), getName(playerid), reason);
- }
- }
- else
- {
- format(logData, 200,"%s %s died, reason: %s \r\n", getDateAndTime(), getName(playerid), reason);
- }
- fwrite(lFile, logData);
- fclose(lFile);
- return 1;
- }
- stock ShootingLog(playerid,damagedid,Float:amount,weaponid,victimcase)
- {
- new path[80];
- switch(SaveMode)
- {
- case 1: format(path,80,"Logs/%s/Shooting%s.log",getName(playerid),getTimeInfo());
- case 2: format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
- case 3: format(path,80,"Logs/Log%s.log",getTimeInfo());
- case 4: format(path,80,"Logs/Shooting%s.log",getTimeInfo());
- }
- new
- File:lFile = fopen(path, io_append),
- logData[200];
- if(victimcase == CULPRIT)
- {
- format(logData, 200,"%s %s ---> %s %f %i \r\n", getDateAndTime(), getName(playerid), getName(damagedid), Float:amount, weaponid);
- }
- else if(victimcase == VICTIM)
- {
- format(logData, 200,"%s %s ---> %s %f %i \r\n", getDateAndTime(), getName(damagedid), getName(playerid), Float:amount, weaponid);
- }
- fwrite(lFile, logData);
- fclose(lFile);
- return 1;
- }
- stock InteriorLog(playerid,int1,int2)
- {
- new path[80];
- switch(SaveMode)
- {
- case 1: format(path,80,"Logs/%s/Interior%s.log",getName(playerid),getTimeInfo());
- case 2: format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
- case 3: format(path,80,"Logs/Log%s.log",getTimeInfo());
- case 4: format(path,80,"Logs/Interior%s.log",getTimeInfo());
- }
- new
- File:lFile = fopen(path, io_append),
- logData[200];
- format(logData, 200,"%s %s's new interior: %i, old interior: %i \r\n", getDateAndTime(), getName(playerid), int1,int2);
- fwrite(lFile, logData);
- fclose(lFile);
- return 1;
- }
- stock OutLog(playerid, seat, vehicleid, modelid)
- {
- new path[80];
- switch(SaveMode)
- {
- case 1: format(path,80,"Logs/%s/CarExit%s.log",getName(playerid),getTimeInfo());
- case 2: format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
- case 3: format(path,80,"Logs/Log%s.log",getTimeInfo());
- case 4: format(path,80,"Logs/CarExit%s.log",getTimeInfo());
- }
- new seatstr[10];
- switch(seat)
- {
- case 0: {seatstr = "Driver";}
- default: {seatstr = "Passenger";}
- }
- new
- File:lFile = fopen(path, io_append),
- logData[200];
- format(logData, 200,"%s %s exited a vehicle, he/she was a %s, VehicleID: %i, ModelID: %i \r\n", getDateAndTime(), getName(playerid), seatstr, vehicleid, modelid);
- fwrite(lFile, logData);
- fclose(lFile);
- return 1;
- }
- stock RconAttemptLog(playerid,bool:success, ip[],password[])
- {
- new path[80];
- switch(SaveMode)
- {
- case 1: format(path,80,"Logs/%s/RconLogin%s.log",getName(playerid),getTimeInfo());
- case 2: format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
- case 3: format(path,80,"Logs/Log%s.log",getTimeInfo());
- case 4: format(path,80,"Logs/RconLogin%s.log",getTimeInfo());
- }
- new
- File:lFile = fopen(path, io_append),
- logData[200];
- if(success == false)
- {
- format(logData, 200,"%s %s (IP:%s) has failed to login as RCON, password: %s\r\n",getDateAndTime(), getName(playerid), ip, password);
- }
- else
- {
- format(logData, 200,"%s %s (IP:%s) has logged in as RCON \r\n", getDateAndTime(), getName(playerid), ip);
- }
- fwrite(lFile, logData);
- fclose(lFile);
- return 1;
- }
- stock RCommand(cmd[])
- {
- new path[21];
- if(SaveMode == 3)
- {
- format(path,80,"Logs/Log%s.log",getTimeInfo());
- }
- else
- {
- format(path,80,"Logs/RconCommand%s.log",getTimeInfo());
- }
- new
- File:lFile = fopen(path, io_append),
- logData[200];
- format(logData, 200,"%s /rcon %s \r\n",getDateAndTime(), cmd);
- fwrite(lFile, logData);
- fclose(lFile);
- return 1;
- }
- stock InLog(playerid, seat, vehicleid, modelid)
- {
- new path[80];
- switch(SaveMode)
- {
- case 1: format(path,80,"Logs/%s/CarEnter%s.log",getName(playerid),getTimeInfo());
- case 2: format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
- case 3: format(path,80,"Logs/Log%s.log",getTimeInfo());
- case 4: format(path,80,"Logs/CarEnter%s.log",getTimeInfo());
- }
- new
- File:lFile = fopen(path, io_append),
- logData[200],seatstr[10];
- switch(seat)
- {
- case 0: {seatstr = "Driver";}
- default: {seatstr = "Passenger";}
- }
- format(logData, 200,"%s %s entered a vehicle, he was a %s, VehicleID: %i, ModelID: %i \r\n",getDateAndTime(), getName(playerid), seatstr, vehicleid, modelid);
- fwrite(lFile, logData);
- fclose(lFile);
- return 1;
- }
- stock LogPlayerLocation(playerid,Float:X,Float:Y,Float:Z)
- {
- new path[80];
- switch(SaveMode)
- {
- case 1: format(path,80,"Logs/%s/Position%s.log",getName(playerid),getTimeInfo());
- case 2: format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
- case 3: format(path,80,"Logs/Log%s.log",getTimeInfo());
- case 4: format(path,80,"Logs/Position%s.log",getTimeInfo());
- }
- new
- File:lFile = fopen(path, io_append),
- logData[200];
- format(logData, 200,"%s %s's Location X: %f | Y: %f | Z: %f\r\n",getDateAndTime(), getName(playerid), X,Y,Z);
- fwrite(lFile, logData);
- fclose(lFile);
- return 1;
- }
- stock Log_Config(playerid)
- {
- new string[370];
- new strlc[14][38];
- switch(PositionLogging)
- {
- case 0:{strlc[0]="PositionLogging[]";}
- case 1:{strlc[0]="PositionLogging[X]";}
- }
- switch(ChatLogging)
- {
- case 0:{strlc[1]="ChatLogging[]";}
- case 1:{strlc[1]="ChatLogging[X]";}
- }
- switch(CommandLogging)
- {
- case 0:{strlc[2]="CommandLogging[]";}
- case 1:{strlc[2]="CommandLogging[X]";}
- }
- switch(ShootingLogging)
- {
- case 0:{strlc[3]="ShootingLogging[]";}
- case 1:{strlc[3]="ShootingLogging[X]";}
- }
- switch(DeathLogging)
- {
- case 0:{strlc[4]="DeathLogging[]";}
- case 1:{strlc[4]="DeathLogging[X]";}
- }
- switch(ConnectLogging)
- {
- case 0:{strlc[5]="ConnectLogging[]";}
- case 1:{strlc[5]="ConnectLogging[X]";}
- }
- switch(DisconnectLogging)
- {
- case 0:{strlc[6]="DisconnectLogging[]";}
- case 1:{strlc[6]="DisconnectLogging[X]";}
- }
- switch(InteriorLogging)
- {
- case 0:{strlc[7]="InteriorLogging[]";}
- case 1:{strlc[7]="InteriorLogging[X]";}
- }
- switch(RconLoginLogging)
- {
- case 0:{strlc[8]="RconLoginLogging[]";}
- case 1:{strlc[8]="RconLoginLogging[X]";}
- }
- switch(CarEnterLogging)
- {
- case 0:{strlc[9]="CarEnterLogging[]";}
- case 1:{strlc[9]="CarEnterLogging[X]";}
- }
- switch(CarExitLogging)
- {
- case 0:{strlc[10]="CarExitLogging[]";}
- case 1:{strlc[10]="CarExitLogging[X]";}
- }
- switch(RconCommandLogging)
- {
- case 0:{strlc[11]="RconCommandLogging[]";}
- case 1:{strlc[11]="RconCommandLogging[X]";}
- }
- switch(SaveMode)
- {
- case 1:{strlc[12]="SaveMode 1[X] 2[ ] 3[ ] 4[ ]";}
- case 2:{strlc[12]="SaveMode 1[ ] 2[X] 3[ ] 4[ ]";}
- case 3:{strlc[12]="SaveMode 1[ ] 2[ ] 3[X] 4[ ]";}
- case 4:{strlc[12]="SaveMode 1[ ] 2[ ] 3[ ] 4[X]";}
- }
- switch(savetime)
- {
- case 0:{strlc[13]="Save logfiles per (Function disabled)";}
- case 1:{strlc[13]="Save logfiles per hour";}
- case 2:{strlc[13]="Save logfiles per day";}
- case 3:{strlc[13]="Save logfiles per month";}
- case 4:{strlc[13]="Save logfiles per year";}
- }
- format(string,370,"%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\nPositionLogInterval\n \nDisable All\nEnable All",strlc[0],strlc[1],strlc[2],strlc[3],strlc[4],strlc[5],strlc[6],strlc[7],strlc[8],strlc[9],strlc[10],strlc[11],strlc[12],strlc[13]);
- ShowPlayerDialog(playerid,LOGCONFIG,DIALOG_STYLE_LIST,"Log Config",string,"Confirm","Back");
- return 1;
- }
- stock Log_Clean(playerid)
- {
- if(SaveMode == 1)
- {
- ShowPlayerDialog(playerid,SAVEMODE1_CHOOSEPLAYER,DIALOG_STYLE_INPUT,"Log clean","Choose a player to delete his logfiles(You will choose the specific log afterwards)","Confirm","Back");
- }
- else if(SaveMode == 2)
- {
- ShowPlayerDialog(playerid,SAVEMODE2_CHOOSEPLAYER,DIALOG_STYLE_INPUT,"Log clean","Which players file should be cleaned?\n(The full playername, not the player id)","Confirm","Back");
- }
- else if(SaveMode == 3)
- {
- new msg[200];
- format(msg,200,"Are you sure that you want to clean the log file? (Size: %i)",flength(fopen("Logs/Log.log")));
- ShowPlayerDialog(playerid,SAVEMODE3_CLEAN,DIALOG_STYLE_MSGBOX,"Log clean",msg,"Confirm","Back");
- }
- else
- {
- getLogSizes(playerid);
- }
- return 1;
- }
- stock getLogSizes(playerid)
- {
- new alog[12][60],abig[1200];
- format(alog[0],60,"PositionLog(Size:%i)",flength(fopen("Logs/Position.log")));
- format(alog[1],60,"ChatLog(Size:%i)",flength(fopen("Logs/Chat.log")));
- format(alog[2],60,"CommandLog(Size:%i)",flength(fopen("Logs/Command.log")));
- format(alog[3],60,"ShootingLog(Size:%i)",flength(fopen("Logs/Shooting.log")));
- format(alog[4],60,"DeathLog(Size:%i)",flength(fopen("Logs/Death.log")));
- format(alog[5],60,"ConnectLog(Size:%i)",flength(fopen("Logs/Connect.log")));
- format(alog[6],60,"DisconnectLog(Size:%i)",flength(fopen("Logs/Disconnect.log")));
- format(alog[7],60,"InteriorLog(Size:%i)",flength(fopen("Logs/Interior.log")));
- format(alog[8],60,"RconLoginLog(Size:%i)",flength(fopen("Logs/RconLogin.log")));
- format(alog[9],60,"CarEnterLog(Size:%i)",flength(fopen("Logs/CarEnter.log")));
- format(alog[10],60,"CarExitLog(Size:%i)",flength(fopen("Logs/CarExit.log")));
- format(alog[11],60,"RconCommandLog(Size:%i)",flength(fopen("Logs/RconCommand.log")));
- format(abig,1200,"%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s",alog[0],alog[1],alog[2],alog[3],alog[4],alog[5],alog[6],alog[7],alog[8],alog[9],alog[10],alog[11]);
- ShowPlayerDialog(playerid,SAVEMODE4_CHOOSE,DIALOG_STYLE_LIST,"Log clean",abig,"Confirm","Back");
- return 1;
- }
- stock cleanLog(playerid,logid)
- {
- new logcl[125];
- switch(logid)
- {
- case 0: {format(logcl,125,"Are you sure that you want to clean the Position Log file(Size:%i)",flength(fopen("Logs/Position.log"))); ShowPlayerDialog(playerid,S4_CLEAN_POSITION,DIALOG_STYLE_LIST,"Log clean",logcl,"Confirm","Back");}
- case 1: {format(logcl,125,"Are you sure that you want to clean the Chat Log file(Size:%i)",flength(fopen("Logs/Chat.log"))); ShowPlayerDialog(playerid,S4_CLEAN_CHAT,DIALOG_STYLE_LIST,"Log clean",logcl,"Confirm","Back");}
- case 2: {format(logcl,125,"Are you sure that you want to clean the Command Log file(Size:%i)",flength(fopen("Logs/Command.log"))); ShowPlayerDialog(playerid,S4_CLEAN_COMMAND,DIALOG_STYLE_LIST,"Log clean",logcl,"Confirm","Back");}
- case 3: {format(logcl,125,"Are you sure that you want to clean the Shooting Log file(Size:%i)",flength(fopen("Logs/Shooting.log"))); ShowPlayerDialog(playerid,S4_CLEAN_SHOOTING,DIALOG_STYLE_LIST,"Log clean",logcl,"Confirm","Back");}
- case 4: {format(logcl,125,"Are you sure that you want to clean the Death Log file(Size:%i)",flength(fopen("Logs/Death.log"))); ShowPlayerDialog(playerid,S4_CLEAN_DEATH,DIALOG_STYLE_LIST,"Log clean",logcl,"Confirm","Back");}
- case 5: {format(logcl,125,"Are you sure that you want to clean the Connect Log file(Size:%i)",flength(fopen("Logs/Connect.log"))); ShowPlayerDialog(playerid,S4_CLEAN_CONNECT,DIALOG_STYLE_LIST,"Log clean",logcl[5],"Confirm","Back");}
- case 6: {format(logcl,125,"Are you sure that you want to clean the Disconnect Log file(Size:%i)",flength(fopen("Logs/Disconnect.log"))); ShowPlayerDialog(playerid,S4_CLEAN_DISCONNECT,DIALOG_STYLE_LIST,"Log clean",logcl,"Confirm","Back");}
- case 7: {format(logcl,125,"Are you sure that you want to clean the Interior Log file(Size:%i)",flength(fopen("Logs/Interior.log"))); ShowPlayerDialog(playerid,S4_CLEAN_INTERIOR,DIALOG_STYLE_LIST,"Log clean",logcl,"Confirm","Back");}
- case 8: {format(logcl,125,"Are you sure that you want to clean the RconLogin Log file(Size:%i)",flength(fopen("Logs/RconLogin.log"))); ShowPlayerDialog(playerid,S4_CLEAN_RCONLOGIN,DIALOG_STYLE_LIST,"Log clean",logcl,"Confirm","Back");}
- case 9: {format(logcl,125,"Are you sure that you want to clean the CarEnter Log file(Size:%i)",flength(fopen("Logs/CarEnter.log"))); ShowPlayerDialog(playerid,S4_CLEAN_CARENTER,DIALOG_STYLE_LIST,"Log clean",logcl,"Confirm","Back");}
- case 10: {format(logcl,125,"Are you sure that you want to clean the CarExit Log file(Size:%i)",flength(fopen("Logs/CarExit.log"))); ShowPlayerDialog(playerid,S4_CLEAN_CAREXIT,DIALOG_STYLE_LIST,"Log clean",logcl,"Confirm","Back");}
- case 11: {format(logcl,125,"Are you sure that you want to clean the RconCommand Log file(Size:%i)",flength(fopen("Logs/RconCommand.log"))); ShowPlayerDialog(playerid,S4_CLEAN_RCONCOMMAND,DIALOG_STYLE_LIST,"Log clean",logcl,"Confirm","Back");}
- }
- return 1;
- }
- //PUBLICS (non-default)
- forward LogLoc(playerid);
- public LogLoc(playerid)
- {
- new Float:X,Float:Y,Float:Z;
- GetPlayerPos(playerid,X,Y,Z);
- LogPlayerLocation(playerid,X,Y,Z);
- return 1;
- }
- forward LogCar(playerid);
- public LogCar(playerid)
- {
- InLog(playerid,GetPlayerVehicleSeat(playerid),GetPlayerVehicleID(playerid),GetVehicleModel(GetPlayerVehicleID(playerid)));
- return 1;
- }
- forward MyHttpResponse(index, response_code, data[]);
- public MyHttpResponse(index, response_code, data[])
- {
- if(!strcmp(data, VERSION, true))
- {
- print("[Logging System] The Logging filterscript needs an update.");
- printf("[Logging System] Latest Version: %s", data);
- printf("[Logging System] Your Version: %s", VERSION);
- print("[Logging System] Downloadlink: https://dl.dropboxusercontent.com/u/89362253/Log.zip");
- }
- else
- {
- print("[Logging System] The Logging system is up to date.");
- }
- return 1;
- }
- //COMMANDS
- CMD:logmenu(playerid,params[])
- {
- if(IsPlayerAdmin(playerid))
- {
- ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
- }
- return 1;
- }
- CMD:logenable(playerid,params[])
- {
- if(IsPlayerAdmin(playerid))
- {
- new log;
- if(sscanf(params,"i",log)) return SendClientMessage(playerid,-1,"[Logging System] Usage: /logenable [log] \n1 = RconCommandLogging\n2 = ChatLogging\n3 = CommandLogging\n4 = ShootingLogging\n5 = PositionLogging\n6 = DeathLogging\n7 = ConnectLogging\n8 = DisconnectLogging\n9 = RconLoginLogging\n10 = InteriorLogging\n11 = CarEnterLogging\n12 = CarExitLogging");
- switch(log)
- {
- case 1: {RconCommandLogging = 1; dini_IntSet(File,"RconCommandLogging",1); SendClientMessage(playerid,-1,"[Logging System] Rcon command logging diabled.");}
- case 2: {ChatLogging = 1; dini_IntSet(File,"ChatLogging",1); SendClientMessage(playerid,-1,"[Logging System] Chat logging diabled.");}
- case 3: {CommandLogging = 1; dini_IntSet(File,"CommandLogging",1); SendClientMessage(playerid,-1,"[Logging System] Command logging diabled.");}
- case 4: {ShootingLogging = 1; dini_IntSet(File,"ShootingLogging",1); SendClientMessage(playerid,-1,"[Logging System] Shooting command logging diabled.");}
- case 5: {PositionLogging = 1; dini_IntSet(File,"PositionLogging",1); SendClientMessage(playerid,-1,"[Logging System] Position command logging diabled.");}
- case 6: {RconLoginLogging = 1; dini_IntSet(File,"RconLoginLogging",1); SendClientMessage(playerid,-1,"[Logging System] Rcon login logging diabled.");}
- case 7: {DeathLogging = 1; dini_IntSet(File,"DeathLogging",1); SendClientMessage(playerid,-1,"[Logging System] Death logging diabled.");}
- case 8: {ConnectLogging = 1; dini_IntSet(File,"ConnectLogging",1); SendClientMessage(playerid,-1,"[Logging System] Connect command logging diabled.");}
- case 9: {DisconnectLogging = 1; dini_IntSet(File,"DisconnectLogging",1); SendClientMessage(playerid,-1,"[Logging System] Disconnect command logging diabled.");}
- case 10: {InteriorLogging = 1; dini_IntSet(File,"InteriorLogging",1); SendClientMessage(playerid,-1,"[Logging System] Interior logging diabled.");}
- case 11: {CarEnterLogging = 1; dini_IntSet(File,"CarEnterLogging",1); SendClientMessage(playerid,-1,"[Logging System] Car enter logging diabled.");}
- case 12: {CarExitLogging = 1; dini_IntSet(File,"CarExitLogging",1); SendClientMessage(playerid,-1,"[Logging System] Car exit logging diabled.");}
- default: {SendClientMessage(playerid, -1, "[Logging System] Your input was incorrect, try again.");}
- }
- }
- return 1;
- }
- CMD:logdisable(playerid,params[])
- {
- if(IsPlayerAdmin(playerid))
- {
- new log;
- if(sscanf(params,"i",log)) return SendClientMessage(playerid,-1,"[Logging System] Usage: /logdisable [log] \n1 = RconCommandLogging\n2 = ChatLogging\n3 = CommandLogging\n4 = ShootingLogging\n5 = PositionLogging\n6 = DeathLogging\n7 = ConnectLogging\n8 = DisconnectLogging\n9 = RconLoginLogging\n10 = InteriorLogging\n11 = CarEnterLogging\n12 = CarExitLogging");
- switch(log)
- {
- case 1: {RconCommandLogging = 0; dini_IntSet(File,"RconCommandLogging",0); SendClientMessage(playerid,-1,"[Logging System] Rcon command logging diabled.");}
- case 2: {ChatLogging = 0; dini_IntSet(File,"ChatLogging",0); SendClientMessage(playerid,-1,"[Logging System] Chat logging diabled.");}
- case 3: {CommandLogging = 0; dini_IntSet(File,"CommandLogging",0); SendClientMessage(playerid,-1,"[Logging System] Command logging diabled.");}
- case 4: {ShootingLogging = 0; dini_IntSet(File,"ShootingLogging",0); SendClientMessage(playerid,-1,"[Logging System] Shooting command logging diabled.");}
- case 5: {PositionLogging = 0; dini_IntSet(File,"PositionLogging",0); SendClientMessage(playerid,-1,"[Logging System] Position command logging diabled.");}
- case 6: {RconLoginLogging = 0; dini_IntSet(File,"RconLoginLogging",0); SendClientMessage(playerid,-1,"[Logging System] Rcon login logging diabled.");}
- case 7: {DeathLogging = 0; dini_IntSet(File,"DeathLogging",0); SendClientMessage(playerid,-1,"[Logging System] Death logging diabled.");}
- case 8: {ConnectLogging = 0; dini_IntSet(File,"ConnectLogging",0); SendClientMessage(playerid,-1,"[Logging System] Connect command logging diabled.");}
- case 9: {DisconnectLogging = 0; dini_IntSet(File,"DisconnectLogging",0); SendClientMessage(playerid,-1,"[Logging System] Disconnect command logging diabled.");}
- case 10: {InteriorLogging = 0; dini_IntSet(File,"InteriorLogging",0); SendClientMessage(playerid,-1,"[Logging System] Interior logging diabled.");}
- case 11: {CarEnterLogging = 0; dini_IntSet(File,"CarEnterLogging",0); SendClientMessage(playerid,-1,"[Logging System] Car enter logging diabled.");}
- case 12: {CarExitLogging = 0; dini_IntSet(File,"CarExitLogging",0); SendClientMessage(playerid,-1,"[Logging System] Car exit logging diabled.");}
- default: {SendClientMessage(playerid, -1, "[Logging System] Your input was incorrect, try again.");}
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment