CrimeBallz

Logging Fitlerscript

Jan 31st, 2016
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 49.41 KB | None | 0 0
  1. //Log Filterscript by [Bios]Marcel
  2. //If you need any help at working on this script you can message me on forum.sa-mp.com
  3. #define FILTERSCRIPT
  4.  
  5. //INCLUDES
  6. #include <a_samp>
  7. #include <Directory>
  8. #include <Dini>
  9. #include <a_http>
  10. #include <zcmd>
  11. #include <sscanf2>
  12.  
  13. //PUBLIC VARIABLES
  14. new VERSION[9] = "1.3.0.14"; //DO NOT CHANGE THIS, IT TELLS U IF THERE IS A NEWER VERSION!
  15. new savetime = 0;
  16. new PositionLogging;
  17. new ChatLogging;
  18. new CommandLogging;
  19. new ShootingLogging;
  20. new DeathLogging;
  21. new ConnectLogging;
  22. new DisconnectLogging;
  23. new InteriorLogging;
  24. new RconLoginLogging;
  25. new CarEnterLogging;
  26. new CarExitLogging;
  27. new RconCommandLogging;
  28. new SaveMode;
  29. new Timer[MAX_PLAYERS];
  30. new gPath[70];
  31.  
  32. //DEFINES
  33. #define LOGMENU 1
  34. #define LOGCONFIG 2
  35. #define SAVEMODE2_CHOOSEPLAYER 3
  36. #define SAVEMODE3_CLEAN 4
  37. #define SAVEMODE4_CHOOSE 5
  38. #define S4_CLEAN_POSITION 6
  39. #define S4_CLEAN_CHAT 7
  40. #define S4_CLEAN_COMMAND 8
  41. #define S4_CLEAN_SHOOTING 9
  42. #define S4_CLEAN_DEATH 10
  43. #define S4_CLEAN_CONNECT 11
  44. #define S4_CLEAN_DISCONNECT 12
  45. #define S4_CLEAN_INTERIOR 13
  46. #define S4_CLEAN_RCONLOGIN 14
  47. #define S4_CLEAN_CARENTER 15
  48. #define S4_CLEAN_CAREXIT 16
  49. #define S4_CLEAN_RCONCOMMAND 17
  50. #define POSLOGINT 18
  51. #define SAVEMODE1_CHOOSEPLAYER 19
  52. #define SAVEMODE1_CHOOSELOG 20
  53. #define SETPOSLOGINTERVAL 21
  54.  
  55. #define CULPRIT 1
  56. #define VICTIM 2
  57.  
  58. #define FILE "Logs/Config.cfg"
  59.  
  60. //PUBLICS (default)
  61. public OnFilterScriptInit()
  62. {
  63.     print("[Logging System] Log Filterscript loaded.");
  64.     checkVersion();
  65.     DirCreate("Logs");
  66.     if(fexist("Logs/LogConfig.cfg"))
  67.     {
  68.         dini_Create(FILE);
  69.         dini_IntSet(FILE,"PositionLogging",dini_Int("Logs/LogConfig.cfg","PositionLogging"));
  70.         dini_IntSet(FILE,"ChatLogging",dini_Int("Logs/LogConfig.cfg","ChatLogging"));
  71.         dini_IntSet(FILE,"CommandLogging",dini_Int("Logs/LogConfig.cfg","CommandLogging"));
  72.         dini_IntSet(FILE,"ShootingLogging",dini_Int("Logs/LogConfig.cfg","ShootingLogging"));
  73.         dini_IntSet(FILE,"DeathLogging",dini_Int("Logs/LogConfig.cfg","DeathLogging"));
  74.         dini_IntSet(FILE,"ConnectLogging",dini_Int("Logs/LogConfig.cfg","ConnectLogging"));
  75.         dini_IntSet(FILE,"DisconnectLogging",dini_Int("Logs/LogConfig.cfg","DisconnectLogging"));
  76.         dini_IntSet(FILE,"InteriorLogging",dini_Int("Logs/LogConfig.cfg","InteriorLogging"));
  77.         dini_IntSet(FILE,"RconLoginLogging",dini_Int("Logs/LogConfig.cfg","RconLoginLogging"));
  78.         dini_IntSet(FILE,"CarEnterLogging",dini_Int("Logs/LogConfig.cfg","CarEnterLogging"));
  79.         dini_IntSet(FILE,"CarExitLogging",dini_Int("Logs/LogConfig.cfg","CarExitLogging"));
  80.         dini_IntSet(FILE,"RconCommandLogging",dini_Int("Logs/LogConfig.cfg","RconCommandLogging"));
  81.         dini_IntSet(FILE,"SaveMode",dini_Int("Logs/LogConfig.cfg","SaveMode"));
  82.         dini_Set(FILE,"LogFilesPerX","no");
  83.         dini_IntSet(FILE,"PositionLogInterval",dini_Int("Logs/LogConfig.cfg","PositionLogInterval"));
  84.     }
  85.     if(dini_Create(FILE))
  86.     {
  87.         dini_IntSet(FILE,"PositionLogging",1);
  88.         dini_IntSet(FILE,"ChatLogging",1);
  89.         dini_IntSet(FILE,"CommandLogging",1);
  90.         dini_IntSet(FILE,"ShootingLogging",1);
  91.         dini_IntSet(FILE,"DeathLogging",1);
  92.         dini_IntSet(FILE,"ConnectLogging",1);
  93.         dini_IntSet(FILE,"DisconnectLogging",1);
  94.         dini_IntSet(FILE,"InteriorLogging",1);
  95.         dini_IntSet(FILE,"RconLoginLogging",1);
  96.         dini_IntSet(FILE,"CarEnterLogging",1);
  97.         dini_IntSet(FILE,"CarExitLogging",1);
  98.         dini_IntSet(FILE,"RconCommandLogging",1);
  99.         dini_IntSet(FILE,"SaveMode",1);
  100.         dini_Set(FILE,"LogFilesPerX","no");
  101.         dini_IntSet(FILE,"PositionLogInterval",1500);
  102.     }
  103.     LoadCFG();
  104.     if((SaveMode > 4) || (SaveMode < 1))
  105.     {
  106.         dini_IntSet(FILE,"SaveMode",1);
  107.         print("[Logging System]The savemode was automatically set to 1 since it wasn't in range of 1 and 4.");
  108.     }
  109.     if(SaveMode == 4)
  110.     {
  111.         dini_Create("Logs/Chat.log");
  112.         dini_Create("Logs/Command.log");
  113.         dini_Create("Logs/Connect.log");
  114.         dini_Create("Logs/Death.log");
  115.         dini_Create("Logs/Disconnect.log");
  116.         dini_Create("Logs/Interior.log");
  117.         dini_Create("Logs/CarEnter.log");
  118.         dini_Create("Logs/CarExit.log");
  119.         dini_Create("Logs/Shooting.log");
  120.         dini_Create("Logs/RconLogin.log");
  121.         dini_Create("Logs/Position.log");
  122.     }
  123.     if(RconCommandLogging)
  124.     {
  125.         if(SaveMode != 3)
  126.         {
  127.             dini_Create("Logs/RconCommand.log");
  128.         }
  129.     }
  130.     return 1;
  131. }
  132.  
  133. public OnRconLoginAttempt(ip[], password[], success)
  134. {
  135.     if(RconLoginLogging)
  136.     {
  137.         new IP[16];
  138.         for(new i=0; i<MAX_PLAYERS; i++)
  139.         {
  140.             GetPlayerIp(i, IP, 16);
  141.             if(!strcmp(ip, IP, true))
  142.             {
  143.                 RconAttemptLog(i,success ? true : false,ip,password);
  144.                 break;
  145.             }
  146.         }
  147.     }
  148.     return 1;
  149. }
  150.  
  151. public OnRconCommand(cmd[])
  152. {
  153.     RCommand(cmd);
  154.     return 1;
  155. }
  156.  
  157. public OnPlayerSpawn(playerid)
  158. {
  159.     if(PositionLogging)
  160.     {
  161.         Timer[playerid] = SetTimerEx("LogLoc",dini_Int(FILE,"PosiotionLogInterval"),true,"i",playerid);
  162.     }
  163.     return 1;
  164. }
  165.  
  166. public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
  167. {
  168.     if(ShootingLogging)
  169.     {
  170.         ShootingLog(playerid,issuerid,amount,weaponid,CULPRIT);
  171.         ShootingLog(issuerid,playerid,amount,weaponid,VICTIM);
  172.     }
  173.     return 1;
  174. }
  175.  
  176. public OnPlayerConnect(playerid)
  177. {
  178.     if(SaveMode == 1)
  179.     {
  180.         new path[80];
  181.         format(path,80,"Logs/%s",getName(playerid));
  182.         DirCreate(path);
  183.     }
  184.     else if(SaveMode == 2)
  185.     {
  186.         new path[80];
  187.         format(path,80,"Logs/%s.log",getName(playerid));
  188.         dini_Create(path);
  189.     }
  190.     if(ConnectLogging)
  191.     {
  192.         ConnectLog(playerid);
  193.     }
  194.     return 1;
  195. }
  196.  
  197. public OnPlayerDisconnect(playerid, reason)
  198. {
  199.     if(DisconnectLogging)
  200.     {
  201.         DisconnectLog(playerid, reason);
  202.     }
  203.     KillTimer(Timer[playerid]);
  204.     return 1;
  205. }
  206.  
  207. public OnPlayerDeath(playerid, killerid, reason)
  208. {
  209.     if(DeathLogging)
  210.     {
  211.         if(killerid != INVALID_PLAYER_ID)
  212.         {
  213.             DeathLog(playerid,killerid,reason,VICTIM);
  214.             DeathLog(killerid,playerid,reason,CULPRIT);
  215.         }
  216.         else
  217.         {
  218.             DeathLog(playerid,-1,reason,0);
  219.         }
  220.     }
  221.  
  222. }
  223.  
  224. public OnPlayerText(playerid, text[])
  225. {
  226.     if(ChatLogging)
  227.     {
  228.         ChatLog(playerid, text);
  229.     }
  230.     return 1;
  231. }
  232.  
  233. public OnPlayerCommandText(playerid, cmdtext[])
  234. {
  235.     if(CommandLogging)
  236.     {
  237.         CommandLog(playerid, cmdtext);
  238.     }
  239.     return 0;
  240. }
  241.  
  242. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  243. {
  244.     if(CarEnterLogging)
  245.     {
  246.         SetTimerEx("LogCar",3000,false,"i",playerid);
  247.     }
  248.     return 1;
  249. }
  250.  
  251. public OnPlayerExitVehicle(playerid, vehicleid)
  252. {
  253.     if(CarExitLogging)
  254.     {
  255.         OutLog(playerid,GetPlayerVehicleSeat(playerid),vehicleid,GetVehicleModel(vehicleid));
  256.     }
  257.     return 1;
  258. }
  259.  
  260. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  261. {
  262.     switch(dialogid)
  263.     {
  264.         case LOGMENU:
  265.         {
  266.             if(response)
  267.             {
  268.                 if(listitem == 0)
  269.                 {
  270.                     Log_Config(playerid);
  271.                 }
  272.                 else
  273.                 {
  274.                     if(savetime != 0)
  275.                     {
  276.                         Log_Config(playerid);
  277.                     }
  278.                     else
  279.                     {
  280.                         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)");
  281.                     }
  282.                 }
  283.             }
  284.         }
  285.         case SAVEMODE1_CHOOSEPLAYER:
  286.         {
  287.             if(response)
  288.             {
  289.                 new path[70];
  290.                 format(path,70,"Logs/%s",inputtext);
  291.                 if(CheckPath(path))
  292.                 {
  293.                     gPath = path;
  294.                     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");
  295.                 }
  296.             }
  297.             else
  298.             {
  299.                 Log_Clean(playerid);
  300.             }
  301.         }
  302.         case SAVEMODE1_CHOOSELOG:
  303.         {
  304.             if(response)
  305.             {
  306.                 new path[75];
  307.                 switch(listitem)
  308.                 {
  309.                     case 0:
  310.                     {
  311.                         format(path,75,"%s/Position.log",gPath);
  312.                     }
  313.                     case 1:
  314.                     {
  315.                         format(path,75,"%s/Chat.log",gPath);
  316.                     }
  317.                     case 2:
  318.                     {
  319.                         format(path,75,"%s/Command.log",gPath);
  320.                     }
  321.                     case 3:
  322.                     {
  323.                         format(path,75,"%s/Shooting.log",gPath);
  324.                     }
  325.                     case 4:
  326.                     {
  327.                         format(path,75,"%s/Death.log",gPath);
  328.                     }
  329.                     case 5:
  330.                     {
  331.                         format(path,75,"%s/Connect.log",gPath);
  332.                     }
  333.                     case 6:
  334.                     {
  335.                         format(path,75,"%s/Disconnecct.log",gPath);
  336.                     }
  337.                     case 7:
  338.                     {
  339.                         format(path,75,"%s/Interior.log",gPath);
  340.                     }
  341.                     case 8:
  342.                     {
  343.                         format(path,75,"%s/RconLogin.log",gPath);
  344.                     }
  345.                     case 9:
  346.                     {
  347.                         format(path,75,"%s/CarEnter.log",gPath);
  348.                     }
  349.                     case 10:
  350.                     {
  351.                         format(path,75,"%s/CarExit.log",gPath);
  352.                     }
  353.                 }
  354.                 eraseFile(path);
  355.             }
  356.             else
  357.             {
  358.                 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");
  359.             }
  360.          }
  361.         case SAVEMODE2_CHOOSEPLAYER:
  362.         {
  363.             if(response)
  364.             {
  365.                 new path[70];
  366.                 format(path,70,"Logs/%s.log",inputtext);
  367.                 if(!fexist(path))
  368.                 {
  369.                     ShowPlayerDialog(playerid,SAVEMODE2_CHOOSEPLAYER,DIALOG_STYLE_INPUT,"Log clean","Which Player File should be cleaned?\n(The Full Playername not PlayerID)","Confirm","Back");
  370.                     GameTextForPlayer(playerid,"Invalid Playername! (Watch out for case sensitive)",3000,5);
  371.                 }
  372.                 else
  373.                 {
  374.                     eraseFile(path);
  375.                     new successMessage[70];
  376.                     format(successMessage,70,"%s's Log was cleaned successful.",inputtext);
  377.                     GameTextForPlayer(playerid,successMessage,3000,5);
  378.                     ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
  379.                 }
  380.             }
  381.             else
  382.             {
  383.                 ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
  384.             }
  385.         }
  386.         case SAVEMODE3_CLEAN:
  387.         {
  388.             if(response)
  389.             {
  390.                 eraseFile("Logs/Log.log");
  391.                 GameTextForPlayer(playerid,"log cleaned successful.",3000,5);
  392.                 ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
  393.             }
  394.             else
  395.             {
  396.                 ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
  397.             }
  398.         }
  399.         case S4_CLEAN_CHAT:
  400.         {
  401.             if(response)
  402.             {
  403.                 eraseFile("Logs/Chat.log");
  404.                 GameTextForPlayer(playerid,"Chat log cleaned successful.",3000,5);
  405.                 ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
  406.             }
  407.             else
  408.             {
  409.                 getLogSizes(playerid);
  410.             }
  411.         }
  412.         case S4_CLEAN_COMMAND:
  413.         {
  414.             if(response)
  415.             {
  416.                 eraseFile("Logs/Command.log");
  417.                 GameTextForPlayer(playerid,"Command log cleaned successful.",3000,5);
  418.                 ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
  419.             }
  420.             else
  421.             {
  422.                 getLogSizes(playerid);
  423.             }
  424.         }
  425.         case S4_CLEAN_SHOOTING:
  426.         {
  427.             if(response)
  428.             {
  429.                 eraseFile("Logs/Shooting.log");
  430.                 GameTextForPlayer(playerid,"Shooting log cleaned successful.",3000,5);
  431.                 ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
  432.             }
  433.             else
  434.             {
  435.                 getLogSizes(playerid);
  436.             }
  437.         }
  438.         case S4_CLEAN_DEATH:
  439.         {
  440.             if(response)
  441.             {
  442.                 eraseFile("Logs/Death.log");
  443.                 GameTextForPlayer(playerid,"Death log cleaned successful.",3000,5);
  444.                 ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
  445.             }
  446.             else
  447.             {
  448.                 getLogSizes(playerid);
  449.             }
  450.         }
  451.         case S4_CLEAN_CONNECT:
  452.         {
  453.             if(response)
  454.             {
  455.                 eraseFile("Logs/Connect.log");
  456.                 GameTextForPlayer(playerid,"Connect log cleaned successful.",3000,5);
  457.                 ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
  458.             }
  459.             else
  460.             {
  461.                 getLogSizes(playerid);
  462.             }
  463.         }
  464.         case S4_CLEAN_DISCONNECT:
  465.         {
  466.             if(response)
  467.             {
  468.                 eraseFile("Logs/Disconnect.log");
  469.                 GameTextForPlayer(playerid,"Disconnect log cleaned successful.",3000,5);
  470.                 ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
  471.             }
  472.             else
  473.             {
  474.                 getLogSizes(playerid);
  475.             }
  476.         }
  477.         case S4_CLEAN_POSITION:
  478.         {
  479.             if(response)
  480.             {
  481.                 eraseFile("Logs/Position.log");
  482.                 GameTextForPlayer(playerid,"Interior log cleaned successful.",3000,5);
  483.                 ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
  484.             }
  485.             else
  486.             {
  487.                 getLogSizes(playerid);
  488.             }
  489.         }
  490.         case S4_CLEAN_INTERIOR:
  491.         {
  492.             if(response)
  493.             {
  494.                 eraseFile("Logs/Interior.log");
  495.                 GameTextForPlayer(playerid,"Interior log cleaned successful.",3000,5);
  496.                 ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
  497.             }
  498.             else
  499.             {
  500.                 getLogSizes(playerid);
  501.             }
  502.         }
  503.         case S4_CLEAN_RCONLOGIN:
  504.         {
  505.             if(response)
  506.             {
  507.                 eraseFile("Logs/RconLogin.log");
  508.                 GameTextForPlayer(playerid,"RconLogin log cleaned successful.",3000,5);
  509.                 ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
  510.             }
  511.             else
  512.             {
  513.                 getLogSizes(playerid);
  514.             }
  515.         }
  516.         case S4_CLEAN_CARENTER:
  517.         {
  518.             if(response)
  519.             {
  520.                 eraseFile("Logs/CarEnter.log");
  521.                 GameTextForPlayer(playerid,"CarEnter log cleaned successful.",3000,5);
  522.                 ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
  523.             }
  524.             else
  525.             {
  526.                 getLogSizes(playerid);
  527.             }
  528.         }
  529.         case S4_CLEAN_CAREXIT:
  530.         {
  531.             if(response)
  532.             {
  533.                 eraseFile("Logs/CarExit.log");
  534.                 GameTextForPlayer(playerid,"CarExit log cleaned successful.",3000,5);
  535.                 ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
  536.             }
  537.             else
  538.             {
  539.                 getLogSizes(playerid);
  540.             }
  541.         }
  542.         case S4_CLEAN_RCONCOMMAND:
  543.         {
  544.             if(response)
  545.             {
  546.                 eraseFile("Logs/RconCommand.log");
  547.                 GameTextForPlayer(playerid,"RconCommand log cleaned successful.",3000,5);
  548.                 ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
  549.             }
  550.             else
  551.             {
  552.                 getLogSizes(playerid);
  553.             }
  554.         }
  555.         case SAVEMODE4_CHOOSE:
  556.         {
  557.             if(response)
  558.             {
  559.                 cleanLog(playerid,listitem);
  560.             }
  561.         }
  562.         case LOGCONFIG:
  563.         {
  564.             if(response)
  565.             {
  566.                 switch(listitem)
  567.                 {
  568.                     case 0:
  569.                     {
  570.                         if(PositionLogging)
  571.                         {
  572.                             PositionLogging = 0;
  573.                             dini_IntSet(FILE,"PositionLogging",0);
  574.                             Log_Config(playerid);
  575.                         }
  576.                         else
  577.                         {
  578.                             PositionLogging = 1;
  579.                             dini_IntSet(FILE,"PositionLogging",1);
  580.                             Log_Config(playerid);
  581.                         }
  582.                     }
  583.                     case 1:
  584.                     {
  585.                         if(ChatLogging)
  586.                         {
  587.                             ChatLogging = 0;
  588.                             dini_IntSet(FILE,"ChatLogging",0);
  589.                             Log_Config(playerid);
  590.                         }
  591.                         else
  592.                         {
  593.                             ChatLogging = 1;
  594.                             dini_IntSet(FILE,"ChatLogging",1);
  595.                             Log_Config(playerid);
  596.                         }
  597.                     }
  598.                     case 2:
  599.                     {
  600.                         if(CommandLogging)
  601.                         {
  602.                             CommandLogging = 0;
  603.                             dini_IntSet(FILE,"CommandLogging",0);
  604.                             Log_Config(playerid);
  605.                         }
  606.                         else
  607.                         {
  608.                             CommandLogging = 1;
  609.                             dini_IntSet(FILE,"CommandLogging",1);
  610.                             Log_Config(playerid);
  611.                         }
  612.                     }
  613.                     case 3:
  614.                     {
  615.                         if(ShootingLogging)
  616.                         {
  617.                             ShootingLogging = 0;
  618.                             dini_IntSet(FILE,"ShootingLogging",0);
  619.                             Log_Config(playerid);
  620.                         }
  621.                         else
  622.                         {
  623.                             ShootingLogging = 1;
  624.                             dini_IntSet(FILE,"ShootingLogging",1);
  625.                             Log_Config(playerid);
  626.                         }
  627.                     }
  628.                     case 4:
  629.                     {
  630.                         if(DeathLogging)
  631.                         {
  632.                             DeathLogging = 0;
  633.                             dini_IntSet(FILE,"DeathLogging",0);
  634.                             Log_Config(playerid);
  635.                         }
  636.                         else
  637.                         {
  638.                             DeathLogging = 1;
  639.                             dini_IntSet(FILE,"DeathLogging",1);
  640.                             Log_Config(playerid);
  641.                         }
  642.                     }
  643.                     case 5:
  644.                     {
  645.                         if(ConnectLogging)
  646.                         {
  647.                             ConnectLogging = 0;
  648.                             dini_IntSet(FILE,"ConnectLogging",0);
  649.                             Log_Config(playerid);
  650.                         }
  651.                         else
  652.                         {
  653.                             ConnectLogging = 1;
  654.                             dini_IntSet(FILE,"ConnectLogging",1);
  655.                             Log_Config(playerid);
  656.                         }
  657.                     }
  658.                     case 6:
  659.                     {
  660.                         if(DisconnectLogging)
  661.                         {
  662.                             DisconnectLogging = 0;
  663.                             dini_IntSet(FILE,"DisconnectLogging",0);
  664.                             Log_Config(playerid);
  665.                         }
  666.                         else
  667.                         {
  668.                             DisconnectLogging = 1;
  669.                             dini_IntSet(FILE,"DisconnectLogging",1);
  670.                             Log_Config(playerid);
  671.                         }
  672.                     }
  673.                     case 7:
  674.                     {
  675.                         if(InteriorLogging)
  676.                         {
  677.                             InteriorLogging = 0;
  678.                             dini_IntSet(FILE,"InteriorLogging",0);
  679.                             Log_Config(playerid);
  680.                         }
  681.                         else
  682.                         {
  683.                             InteriorLogging = 1;
  684.                             dini_IntSet(FILE,"InteriorLogging",1);
  685.                             Log_Config(playerid);
  686.                         }
  687.                     }
  688.                     case 8:
  689.                     {
  690.                         if(RconLoginLogging)
  691.                         {
  692.                             RconLoginLogging = 0;
  693.                             dini_IntSet(FILE,"RconLoginLogging",0);
  694.                             Log_Config(playerid);
  695.                         }
  696.                         else
  697.                         {
  698.                             RconLoginLogging = 1;
  699.                             dini_IntSet(FILE,"RconLoginLogging",1);
  700.                             Log_Config(playerid);
  701.                         }
  702.                     }
  703.                     case 9:
  704.                     {
  705.                         if(CarEnterLogging)
  706.                         {
  707.                             CarEnterLogging = 0;
  708.                             dini_IntSet(FILE,"CarEnterLogging",0);
  709.                             Log_Config(playerid);
  710.                         }
  711.                         else
  712.                         {
  713.                             CarEnterLogging = 1;
  714.                             dini_IntSet(FILE,"CarEnterLogging",1);
  715.                             Log_Config(playerid);
  716.                         }
  717.                     }
  718.                     case 10:
  719.                     {
  720.                         if(CarExitLogging)
  721.                         {
  722.                             CarExitLogging = 0;
  723.                             dini_IntSet(FILE,"CarExitLogging",0);
  724.                             Log_Config(playerid);
  725.                         }
  726.                         else
  727.                         {
  728.                             CarExitLogging = 1;
  729.                             dini_IntSet(FILE,"CarExitLogging",1);
  730.                             Log_Config(playerid);
  731.                         }
  732.                     }
  733.                     case 11:
  734.                     {
  735.                         if(RconCommandLogging)
  736.                         {
  737.                             RconCommandLogging = 0;
  738.                             dini_IntSet(FILE,"RconCommandLogging",0);
  739.                             Log_Config(playerid);
  740.                         }
  741.                         else
  742.                         {
  743.                             RconCommandLogging = 1;
  744.                             dini_IntSet(FILE,"RconCommandLogging",1);
  745.                             Log_Config(playerid);
  746.                         }
  747.                     }
  748.                     case 12:
  749.                     {
  750.                         SaveMode++;
  751.                         if(SaveMode == 5)
  752.                         {
  753.                             SaveMode = 1;
  754.                         }
  755.                         dini_IntSet(FILE,"SaveMode",SaveMode);
  756.                         Log_Config(playerid);
  757.                     }
  758.                     case 13:
  759.                     {
  760.                         savetime++;
  761.                         if(savetime == 5)
  762.                         {
  763.                             savetime = 0;
  764.                         }
  765.                         dini_IntSet(FILE,"LogFilesPerX",savetime);
  766.                         Log_Config(playerid);
  767.                     }
  768.                     case 14:
  769.                     {
  770.                         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");
  771.                     }
  772.                     //CASE 15 existiert nicht da dort eine Leere Spalte ist welche keine Funktion haben soll.
  773.                     /*case 15:
  774.                     {
  775.                     }*/
  776.                     case 16:
  777.                     {
  778.                         PositionLogging = 0;
  779.                         dini_IntSet(FILE,"PositionLogging",0);
  780.                         ChatLogging = 0;
  781.                         dini_IntSet(FILE,"ChatLogging",0);
  782.                         ConnectLogging = 0;
  783.                         dini_IntSet(FILE,"ConnectLogging",0);
  784.                         DisconnectLogging = 0;
  785.                         dini_IntSet(FILE,"DisconnectLogging",0);
  786.                         ShootingLogging = 0;
  787.                         dini_IntSet(FILE,"ShootingLogging",0);
  788.                         DeathLogging = 0;
  789.                         dini_IntSet(FILE,"DeathLogging",0);
  790.                         RconLoginLogging = 0;
  791.                         dini_IntSet(FILE,"RconLoginLogging",0);
  792.                         InteriorLogging = 0;
  793.                         dini_IntSet(FILE,"InteriorLogging",0);
  794.                         CarEnterLogging = 0;
  795.                         dini_IntSet(FILE,"CarEnterLogging",0);
  796.                         CarExitLogging = 0;
  797.                         dini_IntSet(FILE,"CarExitLogging",0);
  798.                         CommandLogging = 0;
  799.                         dini_IntSet(FILE,"CommandLogging",0);
  800.                         RconCommandLogging = 0;
  801.                         dini_IntSet(FILE,"RconCommandLogging",0);
  802.                         Log_Config(playerid);
  803.                     }
  804.                     case 17:
  805.                     {
  806.                         PositionLogging = 1;
  807.                         dini_IntSet(FILE,"PositionLogging",1);
  808.                         ChatLogging = 1;
  809.                         dini_IntSet(FILE,"ChatLogging",1);
  810.                         ConnectLogging = 1;
  811.                         dini_IntSet(FILE,"ConnectLogging",1);
  812.                         DisconnectLogging = 1;
  813.                         dini_IntSet(FILE,"DisconnectLogging",1);
  814.                         ShootingLogging = 1;
  815.                         dini_IntSet(FILE,"ShootingLogging",1);
  816.                         DeathLogging = 1;
  817.                         dini_IntSet(FILE,"DeathLogging",1);
  818.                         RconLoginLogging = 1;
  819.                         dini_IntSet(FILE,"RconLoginLogging",1);
  820.                         InteriorLogging = 1;
  821.                         dini_IntSet(FILE,"InteriorLogging",1);
  822.                         CarEnterLogging = 1;
  823.                         dini_IntSet(FILE,"CarEnterLogging",1);
  824.                         CarExitLogging = 1;
  825.                         dini_IntSet(FILE,"CarExitLogging",1);
  826.                         CommandLogging = 1;
  827.                         dini_IntSet(FILE,"CommandLogging",1);
  828.                         RconCommandLogging = 1;
  829.                         dini_IntSet(FILE,"RconCommandLogging",1);
  830.                         Log_Config(playerid);
  831.                     }
  832.                 }
  833.             }
  834.         }
  835.         case POSLOGINT:
  836.         {
  837.             if(response)
  838.             {
  839.                 if(isNumeric(inputtext))
  840.                 {
  841.                     dini_IntSet(FILE,"PositionLogInterval",strval(inputtext));
  842.                 }
  843.                 else
  844.                 {
  845.                     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");
  846.                 }
  847.             }
  848.             else
  849.             {
  850.                 Log_Config(playerid);
  851.             }
  852.         }
  853.     }
  854.     return 1;
  855. }
  856.  
  857. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  858. {
  859.     if(InteriorLogging)
  860.     {
  861.         InteriorLog(playerid,newinteriorid,oldinteriorid);
  862.     }
  863.     return 1;
  864. }
  865.  
  866. //STOCKS
  867. /**
  868.  * Deletes a file and creates it afterwards
  869.  *
  870.  * @param fileName The string of the file name that you want to be recreated
  871. **/
  872. stock eraseFile(fileName[])
  873. {
  874.     fremove(fileName);
  875.     dini_Create(fileName);
  876.     return 1;
  877. }
  878.  
  879. /**
  880.  * Send a HTTP request to get the latest version number and pass it to the response method
  881.  *
  882. **/
  883. stock checkVersion()
  884. {
  885.     print("Checking Version");
  886.     HTTP(1,HTTP_GET,"dl.dropboxusercontent.com/u/89362253/versions/samplog/version.txt","","MyHttpResponse");
  887.     return 1;
  888. }
  889.  
  890. /**
  891.  * Loads the settings from the file into the variables
  892. **/
  893. stock LoadCFG()
  894. {
  895.     PositionLogging = dini_Int(FILE,"PositionLogging");
  896.     ChatLogging = dini_Int(FILE,"ChatLogging");
  897.     CommandLogging = dini_Int(FILE,"CommandLogging");
  898.     ShootingLogging = dini_Int(FILE,"ShootingLogging");
  899.     DeathLogging = dini_Int(FILE,"DeathLogging");
  900.     ConnectLogging = dini_Int(FILE,"ConnectLogging");
  901.     DisconnectLogging = dini_Int(FILE,"DisconnectLogging");
  902.     InteriorLogging = dini_Int(FILE,"InteriorLogging");
  903.     RconLoginLogging = dini_Int(FILE,"RconLoginLogging");
  904.     CarEnterLogging = dini_Int(FILE,"CarEnterLogging");
  905.     CarExitLogging = dini_Int(FILE,"CarExitLogging");
  906.     RconCommandLogging = dini_Int(FILE,"RconCommandLogging");
  907.     SaveMode = dini_Int(FILE,"SaveMode");
  908.     savetime = dini_Int(FILE,"LogFilesPerX");
  909.     return 1;
  910. }
  911.  
  912. /**
  913.  * Returns the full time and date (Day,Month,Year,Hour,Minute,Second)
  914.  *
  915.  * @return time and date
  916. **/
  917. stock getDateAndTime()
  918. {
  919.     new fyear;
  920.     new fmonth;
  921.     new fday;
  922.     getdate(fyear, fmonth, fday);
  923.     new fhour;
  924.     new fminute;
  925.     new fsecond;
  926.     gettime(fhour, fminute, fsecond);
  927.     new date[32];
  928.     format(date, 32,"[%02d/%02d/%04d %02d:%02d:%02d]", fday, fmonth, fyear, fhour, fminute, fsecond);
  929.     return date;
  930. }
  931.  
  932. /**
  933.  * Returns the time and date, depending on how much of it is needed
  934.  *
  935.  * @return time and date
  936. **/
  937. stock getTimeInfo()
  938. {
  939.     new fyear;
  940.     new fmonth;
  941.     new fday;
  942.     getdate(fyear, fmonth, fday);
  943.     new fhour;
  944.     gettime(fhour);
  945.     new date[32];
  946.     switch(savetime)
  947.     {
  948.         case 0:
  949.         {
  950.             date = "";
  951.         }
  952.         case 1:
  953.         {
  954.             format(date, 32,"-%02d-%02d-%04d_%02d", fday, fmonth, fyear, fhour);
  955.         }
  956.         case 2:
  957.         {
  958.             format(date, 32,"-%02d-%02d-%04d", fday, fmonth, fyear);
  959.         }
  960.         case 3:
  961.         {
  962.             format(date, 32,"-%02d-%04d", fmonth, fyear);
  963.         }
  964.         case 4:
  965.         {
  966.             format(date, 32,"-%04d", fyear);
  967.         }
  968.     }
  969.     return date;
  970. }
  971.  
  972. /**
  973.  * Checks if the given string is numeric
  974.  *
  975.  * @param string the string that is to check
  976.  * @return 1 if it is numeric and 0 if it isn't
  977. **/
  978. stock isNumeric(const string[])
  979. {
  980.     for (new i = 0, j = strlen(string); i < j; i++)
  981.     {
  982.         if (string[i] > '9' || string[i] < '0')
  983.         {
  984.             return 0;
  985.         }
  986.     }
  987.     return 1;
  988. }
  989.  
  990. /**
  991.  * Returns a players name
  992.  *
  993.  * @param playerid the players id that you want to get the name from
  994.  * @return the players name
  995. **/
  996. stock getName(playerid)
  997. {
  998.     new name[MAX_PLAYER_NAME];
  999.     GetPlayerName(playerid,name,MAX_PLAYER_NAME);
  1000.     return name;
  1001. }
  1002.  
  1003. stock ChatLog(playerid, text[])
  1004. {
  1005.     new path[80];
  1006.     switch(SaveMode)
  1007.     {
  1008.         case 1:
  1009.         {
  1010.             format(path,80,"Logs/%s/Chat%s.log",getName(playerid),getTimeInfo());
  1011.         }
  1012.         case 2:
  1013.         {
  1014.             format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
  1015.         }
  1016.         case 3:
  1017.         {
  1018.             format(path,80,"Logs/Log%s.log",getTimeInfo());
  1019.         }
  1020.         case 4:
  1021.         {
  1022.             format(path,80,"Logs/Chat%s.log",getTimeInfo());
  1023.         }
  1024.     }
  1025.     new logData[220];
  1026.     format(logData, 220,"%s %s: %s \r\n", getDateAndTime(), getName(playerid), text);
  1027.     new File:logFile = fopen(path, io_append);
  1028.     fwrite(logFile, logData);
  1029.     fclose(logFile);
  1030.     return 1;
  1031. }
  1032.  
  1033. stock ConnectLog(playerid)
  1034. {
  1035.     new path[80];
  1036.     switch(SaveMode)
  1037.     {
  1038.         case 1:
  1039.         {
  1040.             format(path,80,"Logs/%s/Connect%s.log",getName(playerid),getTimeInfo());
  1041.         }
  1042.         case 2:
  1043.         {
  1044.             format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
  1045.         }
  1046.         case 3:
  1047.         {
  1048.             format(path,80,"Logs/Log%s.log",getTimeInfo());
  1049.         }
  1050.         case 4:
  1051.         {
  1052.             format(path,80,"Logs/Connect%s.log",getTimeInfo());
  1053.         }
  1054.     }
  1055.     new ip[16];
  1056.     GetPlayerIp(playerid,ip,16);
  1057.     new logData[100];
  1058.     format(logData, 100,"%s %s connected with IP: %s \r\n",getDateAndTime(), getName(playerid), ip);
  1059.     new File:logFile = fopen(path, io_append);
  1060.     fwrite(logFile, logData);
  1061.     fclose(logFile);
  1062.     return 1;
  1063. }
  1064.  
  1065. stock DisconnectLog(playerid, reason)
  1066. {
  1067.     new path[80];
  1068.     switch(SaveMode)
  1069.     {
  1070.         case 1:
  1071.         {
  1072.             format(path,80,"Logs/%s/Disconnect%s.log",getName(playerid),getTimeInfo());
  1073.         }
  1074.         case 2:
  1075.         {
  1076.             format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
  1077.         }
  1078.         case 3:
  1079.         {
  1080.             format(path,80,"Logs/Log%s.log",getTimeInfo());
  1081.         }
  1082.         case 4:
  1083.         {
  1084.             format(path,80,"Logs/Disconnect%s.log",getTimeInfo());
  1085.         }
  1086.     }
  1087.     new ip[16];
  1088.     GetPlayerIp(playerid,ip,16);
  1089.     new reasonString[14];
  1090.     switch(reason)
  1091.     {
  1092.         case 0:
  1093.         {
  1094.             reasonString = "Timed out";
  1095.         }
  1096.         case 1:
  1097.         {
  1098.             reasonString = "Leaving";
  1099.         }
  1100.         case 2:
  1101.         {
  1102.             reasonString = "Kicked/Banned";
  1103.         }
  1104.     }
  1105.     new logData[100];
  1106.     format(logData, 100,"%s %s (IP:%s) disconnected, reason: %s \r\n", getDateAndTime(), getName(playerid), ip, reasonString);
  1107.     new File:logFile = fopen(path, io_append);
  1108.     fwrite(logFile, logData);
  1109.     fclose(logFile);
  1110.     return 1;
  1111. }
  1112.  
  1113. stock CommandLog(playerid, cmdtext[])
  1114. {
  1115.     new path[80];
  1116.     switch(SaveMode)
  1117.     {
  1118.         case 1:
  1119.         {
  1120.             format(path,80,"Logs/%s/Command%s.log",getName(playerid),getTimeInfo());
  1121.         }
  1122.         case 2:
  1123.         {
  1124.             format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
  1125.         }
  1126.         case 3:
  1127.         {
  1128.             format(path,80,"Logs/Log%s.log",getTimeInfo());
  1129.         }
  1130.         case 4:
  1131.         {
  1132.             format(path,80,"Logs/Command%s.log",getTimeInfo());
  1133.         }
  1134.     }
  1135.     new logData[200];
  1136.     format(logData, 200,"%s %s: %s \r\n", getDateAndTime(), getName(playerid), cmdtext);
  1137.     new File:logFile = fopen(path, io_append);
  1138.     fwrite(logFile, logData);
  1139.     fclose(logFile);
  1140.     return 1;
  1141. }
  1142.  
  1143. stock DeathLog(playerid,killerid,reason,victimcase)
  1144. {
  1145.     new path[80];
  1146.     switch(SaveMode)
  1147.     {
  1148.         case 1:
  1149.         {
  1150.             format(path,80,"Logs/%s/Death%s.log",getName(playerid),getTimeInfo());
  1151.         }
  1152.         case 2:
  1153.         {
  1154.             format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
  1155.         }
  1156.         case 3:
  1157.         {
  1158.             format(path,80,"Logs/Log%s.log",getTimeInfo());
  1159.         }
  1160.         case 4:
  1161.         {
  1162.             format(path,80,"Logs/Death%s.log",getTimeInfo());
  1163.         }
  1164.     }
  1165.     new logData[200];
  1166.     if(killerid != INVALID_PLAYER_ID)
  1167.     {
  1168.         if(victimcase == VICTIM)
  1169.         {
  1170.             format(logData, 200,"%s %s was killed by: %s, weapon: %s \r\n", getDateAndTime(), getName(playerid), getName(killerid), reason);
  1171.         }
  1172.         else if(victimcase == CULPRIT)
  1173.         {
  1174.             format(logData, 200,"%s %s has killed %s, weapon: %s \r\n",getDateAndTime(), getName(killerid), getName(playerid), reason);
  1175.         }
  1176.     }
  1177.     else
  1178.     {
  1179.         format(logData, 200,"%s %s died, reason: %s \r\n", getDateAndTime(), getName(playerid), reason);
  1180.     }
  1181.     new File:logFile = fopen(path, io_append);
  1182.     fwrite(logFile, logData);
  1183.     fclose(logFile);
  1184.     return 1;
  1185. }
  1186.  
  1187. stock ShootingLog(playerid,damagedid,Float:amount,weaponid,victimcase)
  1188. {
  1189.     new path[80];
  1190.     switch(SaveMode)
  1191.     {
  1192.         case 1:
  1193.         {
  1194.             format(path,80,"Logs/%s/Shooting%s.log",getName(playerid),getTimeInfo());
  1195.         }
  1196.         case 2:
  1197.         {
  1198.             format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
  1199.         }
  1200.         case 3:
  1201.         {
  1202.             format(path,80,"Logs/Log%s.log",getTimeInfo());
  1203.         }
  1204.         case 4:
  1205.         {
  1206.             format(path,80,"Logs/Shooting%s.log",getTimeInfo());
  1207.         }
  1208.     }
  1209.     new logData[200];
  1210.     if(victimcase == CULPRIT)
  1211.     {
  1212.         format(logData, 200,"%s %s ---> %s %f %i \r\n", getDateAndTime(), getName(playerid), getName(damagedid), Float:amount, weaponid);
  1213.     }
  1214.     else if(victimcase == VICTIM)
  1215.     {
  1216.         format(logData, 200,"%s %s ---> %s %f %i \r\n", getDateAndTime(), getName(damagedid), getName(playerid), Float:amount, weaponid);
  1217.     }
  1218.     new File:logFile = fopen(path, io_append);
  1219.     fwrite(logFile, logData);
  1220.     fclose(logFile);
  1221.     return 1;
  1222. }
  1223.  
  1224. stock InteriorLog(playerid,int1,int2)
  1225. {
  1226.     new path[80];
  1227.     switch(SaveMode)
  1228.     {
  1229.         case 1:
  1230.         {
  1231.             format(path,80,"Logs/%s/Interior%s.log",getName(playerid),getTimeInfo());
  1232.         }
  1233.         case 2:
  1234.         {
  1235.             format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
  1236.         }
  1237.         case 3:
  1238.         {
  1239.             format(path,80,"Logs/Log%s.log",getTimeInfo());
  1240.         }
  1241.         case 4:
  1242.         {
  1243.             format(path,80,"Logs/Interior%s.log",getTimeInfo());
  1244.         }
  1245.     }
  1246.     new logData[200];
  1247.     format(logData, 200,"%s %s's new interior: %i, old interior: %i \r\n", getDateAndTime(), getName(playerid), int1,int2);
  1248.     new File:logFile = fopen(path, io_append);
  1249.     fwrite(logFile, logData);
  1250.     fclose(logFile);
  1251.     return 1;
  1252. }
  1253.  
  1254. stock OutLog(playerid, seat, vehicleid, modelid)
  1255. {
  1256.     new path[80];
  1257.     switch(SaveMode)
  1258.     {
  1259.         case 1:
  1260.         {
  1261.             format(path,80,"Logs/%s/CarExit%s.log",getName(playerid),getTimeInfo());
  1262.         }
  1263.         case 2:
  1264.         {
  1265.             format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
  1266.         }
  1267.         case 3:
  1268.         {
  1269.             format(path,80,"Logs/Log%s.log",getTimeInfo());
  1270.         }
  1271.         case 4:
  1272.         {
  1273.             format(path,80,"Logs/CarExit%s.log",getTimeInfo());
  1274.         }
  1275.     }
  1276.     new seatstr[10];
  1277.     switch(seat)
  1278.     {
  1279.          case 0:
  1280.          {
  1281.             seatstr = "Driver";
  1282.          }
  1283.          default:
  1284.          {
  1285.             seatstr = "Passenger";
  1286.          }
  1287.     }
  1288.     new logData[200];
  1289.     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);
  1290.     new File:logFile = fopen(path, io_append);
  1291.     fwrite(logFile, logData);
  1292.     fclose(logFile);
  1293.     return 1;
  1294. }
  1295.  
  1296. stock RconAttemptLog(playerid,bool:success, ip[],password[])
  1297. {
  1298.     new path[80];
  1299.     switch(SaveMode)
  1300.     {
  1301.         case 1:
  1302.         {
  1303.             format(path,80,"Logs/%s/RconLogin%s.log",getName(playerid),getTimeInfo());
  1304.         }
  1305.         case 2:
  1306.         {
  1307.             format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
  1308.         }
  1309.         case 3:
  1310.         {
  1311.             format(path,80,"Logs/Log%s.log",getTimeInfo());
  1312.         }
  1313.         case 4:
  1314.         {
  1315.             format(path,80,"Logs/RconLogin%s.log",getTimeInfo());
  1316.         }
  1317.     }
  1318.     new logData[200];
  1319.     if(success)
  1320.     {
  1321.         format(logData, 200,"%s %s (IP:%s) has failed to login as RCON, password: %s\r\n",getDateAndTime(), getName(playerid), ip, password);
  1322.     }
  1323.     else
  1324.     {
  1325.         format(logData, 200,"%s %s (IP:%s) has logged in as RCON \r\n", getDateAndTime(), getName(playerid), ip);
  1326.     }
  1327.     new File:logFile = fopen(path, io_append);
  1328.     fwrite(logFile, logData);
  1329.     fclose(logFile);
  1330.     return 1;
  1331. }
  1332.  
  1333. stock RCommand(cmd[])
  1334. {
  1335.     new path[21];
  1336.     if(SaveMode == 3)
  1337.     {
  1338.         format(path,80,"Logs/Log%s.log",getTimeInfo());
  1339.     }
  1340.     else
  1341.     {
  1342.         format(path,80,"Logs/RconCommand%s.log",getTimeInfo());
  1343.     }
  1344.     new logData[200];
  1345.     format(logData, 200,"%s /rcon %s \r\n",getDateAndTime(), cmd);
  1346.     new File:logFile = fopen(path, io_append);
  1347.     fwrite(logFile, logData);
  1348.     fclose(logFile);
  1349.     return 1;
  1350. }
  1351.  
  1352. stock InLog(playerid, seat, vehicleid, modelid)
  1353. {
  1354.     new path[80];
  1355.     switch(SaveMode)
  1356.     {
  1357.         case 1:
  1358.         {
  1359.             format(path,80,"Logs/%s/CarEnter%s.log",getName(playerid),getTimeInfo());
  1360.         }
  1361.         case 2:
  1362.         {
  1363.             format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
  1364.         }
  1365.         case 3:
  1366.         {
  1367.             format(path,80,"Logs/Log%s.log",getTimeInfo());
  1368.         }
  1369.         case 4:
  1370.         {
  1371.             format(path,80,"Logs/CarEnter%s.log",getTimeInfo());
  1372.         }
  1373.     }
  1374.     new seatstr[10];
  1375.     switch(seat)
  1376.     {
  1377.          case 0:
  1378.          {
  1379.             seatstr = "Driver";
  1380.          }
  1381.          default:
  1382.          {
  1383.             seatstr = "Passenger";
  1384.          }
  1385.     }
  1386.     new logData[200];
  1387.     format(logData, 200,"%s %s entered a vehicle, he was a %s, VehicleID: %i, ModelID: %i \r\n",getDateAndTime(), getName(playerid), seatstr, vehicleid, modelid);
  1388.     new File:logFile = fopen(path, io_append);
  1389.     fwrite(logFile, logData);
  1390.     fclose(logFile);
  1391.     return 1;
  1392. }
  1393.  
  1394. stock LogPlayerLocation(playerid,Float:X,Float:Y,Float:Z)
  1395. {
  1396.     new path[80];
  1397.     switch(SaveMode)
  1398.     {
  1399.         case 1:
  1400.         {
  1401.             format(path,80,"Logs/%s/Position%s.log",getName(playerid),getTimeInfo());
  1402.         }
  1403.         case 2:
  1404.         {
  1405.             format(path,80,"Logs/%s%s.log",getName(playerid),getTimeInfo());
  1406.         }
  1407.         case 3:
  1408.         {
  1409.             format(path,80,"Logs/Log%s.log",getTimeInfo());
  1410.         }
  1411.         case 4:
  1412.         {
  1413.             format(path,80,"Logs/Position%s.log",getTimeInfo());
  1414.         }
  1415.     }
  1416.     new logData[200];
  1417.     format(logData, 200,"%s %s's Location X: %f | Y: %f | Z: %f\r\n",getDateAndTime(), getName(playerid), X,Y,Z);
  1418.     new File:logFile = fopen(path, io_append);
  1419.     fwrite(logFile, logData);
  1420.     fclose(logFile);
  1421.     return 1;
  1422. }
  1423.  
  1424. /**
  1425.  * Updates the menu dialog
  1426.  *
  1427.  * @param playerid the player who is supposed to see the updated dialog
  1428. **/
  1429. stock Log_Config(playerid)
  1430. {
  1431.     new strlc[14][38];
  1432.     switch(PositionLogging)
  1433.     {
  1434.         case 0:
  1435.         {
  1436.             strlc[0]="PositionLogging[]";
  1437.         }
  1438.         case 1:
  1439.         {
  1440.             strlc[0]="PositionLogging[X]";
  1441.         }
  1442.     }
  1443.     switch(ChatLogging)
  1444.     {
  1445.         case 0:
  1446.         {
  1447.             strlc[1]="ChatLogging[]";
  1448.         }
  1449.         case 1:
  1450.         {
  1451.             strlc[1]="ChatLogging[X]";
  1452.         }
  1453.     }
  1454.     switch(CommandLogging)
  1455.     {
  1456.         case 0:
  1457.         {
  1458.             strlc[2]="CommandLogging[]";
  1459.         }
  1460.         case 1:
  1461.         {
  1462.             strlc[2]="CommandLogging[X]";
  1463.         }
  1464.     }
  1465.     switch(ShootingLogging)
  1466.     {
  1467.         case 0:
  1468.         {
  1469.             strlc[3]="ShootingLogging[]";
  1470.         }
  1471.         case 1:
  1472.         {
  1473.             strlc[3]="ShootingLogging[X]";
  1474.         }
  1475.     }
  1476.     switch(DeathLogging)
  1477.     {
  1478.         case 0:
  1479.         {
  1480.             strlc[4]="DeathLogging[]";
  1481.         }
  1482.         case 1:
  1483.         {
  1484.             strlc[4]="DeathLogging[X]";
  1485.         }
  1486.     }
  1487.     switch(ConnectLogging)
  1488.     {
  1489.         case 0:
  1490.         {
  1491.             strlc[5]="ConnectLogging[]";
  1492.         }
  1493.         case 1:
  1494.         {
  1495.             strlc[5]="ConnectLogging[X]";
  1496.         }
  1497.     }
  1498.     switch(DisconnectLogging)
  1499.     {
  1500.         case 0:
  1501.         {
  1502.             strlc[6]="DisconnectLogging[]";
  1503.         }
  1504.         case 1:
  1505.         {
  1506.             strlc[6]="DisconnectLogging[X]";
  1507.         }
  1508.     }
  1509.     switch(InteriorLogging)
  1510.     {
  1511.         case 0:
  1512.         {
  1513.             strlc[7]="InteriorLogging[]";
  1514.         }
  1515.         case 1:
  1516.         {
  1517.             strlc[7]="InteriorLogging[X]";
  1518.         }
  1519.     }
  1520.     switch(RconLoginLogging)
  1521.     {
  1522.         case 0:
  1523.         {
  1524.             strlc[8]="RconLoginLogging[]";
  1525.         }
  1526.         case 1:
  1527.         {
  1528.             strlc[8]="RconLoginLogging[X]";
  1529.         }
  1530.     }
  1531.     switch(CarEnterLogging)
  1532.     {
  1533.         case 0:
  1534.         {
  1535.             strlc[9]="CarEnterLogging[]";
  1536.         }
  1537.         case 1:
  1538.         {
  1539.             strlc[9]="CarEnterLogging[X]";
  1540.         }
  1541.     }
  1542.     switch(CarExitLogging)
  1543.     {
  1544.         case 0:
  1545.         {
  1546.             strlc[10]="CarExitLogging[]";
  1547.         }
  1548.         case 1:
  1549.         {
  1550.             strlc[10]="CarExitLogging[X]";
  1551.         }
  1552.     }
  1553.     switch(RconCommandLogging)
  1554.     {
  1555.         case 0:
  1556.         {
  1557.             strlc[11]="RconCommandLogging[]";
  1558.         }
  1559.         case 1:
  1560.         {
  1561.             strlc[11]="RconCommandLogging[X]";
  1562.         }
  1563.     }
  1564.     switch(SaveMode)
  1565.     {
  1566.         case 1:
  1567.         {
  1568.             strlc[12]="SaveMode 1[X] 2[ ] 3[ ] 4[ ]";
  1569.         }
  1570.         case 2:
  1571.         {
  1572.             strlc[12]="SaveMode 1[ ] 2[X] 3[ ] 4[ ]";
  1573.         }
  1574.         case 3:
  1575.         {
  1576.             strlc[12]="SaveMode 1[ ] 2[ ] 3[X] 4[ ]";
  1577.         }
  1578.         case 4:
  1579.         {
  1580.             strlc[12]="SaveMode 1[ ] 2[ ] 3[ ] 4[X]";
  1581.         }
  1582.     }
  1583.     switch(savetime)
  1584.     {
  1585.         case 0:
  1586.         {
  1587.             strlc[13]="Save logfiles per (Function disabled)";
  1588.         }
  1589.         case 1:
  1590.         {
  1591.             strlc[13]="Save logfiles per hour";
  1592.         }
  1593.         case 2:
  1594.         {
  1595.             strlc[13]="Save logfiles per day";
  1596.         }
  1597.         case 3:
  1598.         {
  1599.             strlc[13]="Save logfiles per month";
  1600.         }
  1601.         case 4:
  1602.         {
  1603.             strlc[13]="Save logfiles per year";
  1604.         }
  1605.     }
  1606.     new string[370];
  1607.     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]);
  1608.     ShowPlayerDialog(playerid,LOGCONFIG,DIALOG_STYLE_LIST,"Log Config",string,"Confirm","Back");
  1609.     return 1;
  1610. }
  1611.  
  1612. /**
  1613.  * Shows the log clean dialog depending on the SaveMode that is set
  1614.  *
  1615.  * @param playerid the player who is supposed to see the dialog
  1616. **/
  1617. stock Log_Clean(playerid)
  1618. {
  1619.     switch(SaveMode)
  1620.     {
  1621.         case 1:
  1622.         {
  1623.             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");
  1624.         }
  1625.         case 2:
  1626.         {
  1627.             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");
  1628.         }
  1629.         case 3:
  1630.         {
  1631.             new msg[200];
  1632.             format(msg,200,"Are you sure that you want to clean the log file? (Size: %i)",getFileSize("Logs/Log.log"));
  1633.             ShowPlayerDialog(playerid,SAVEMODE3_CLEAN,DIALOG_STYLE_MSGBOX,"Log clean",msg,"Confirm","Back");
  1634.         }
  1635.         default:
  1636.         {
  1637.             getLogSizes(playerid);
  1638.         }
  1639.     }
  1640.     return 1;
  1641. }
  1642. /**
  1643.  * Returns the filesize of a specific file
  1644.  *
  1645.  * @param filename the name of the file thats to check
  1646.  *
  1647.  * @return the filesize
  1648. **/
  1649. stock getFileSize(filename[])
  1650. {
  1651.     new File:sizetoget = fopen(filename,io_read);
  1652.     new fileLength = flength(sizetoget);
  1653.     fclose(sizetoget);
  1654.     return fileLength;
  1655. }
  1656.  
  1657. stock getLogSizes(playerid)
  1658. {
  1659.     new alog[12][60];
  1660.     format(alog[0],60,"PositionLog(Size:%i)",getFileSize("Logs/Position.log"));
  1661.     format(alog[1],60,"ChatLog(Size:%i)",getFileSize("Logs/Chat.log"));
  1662.     format(alog[2],60,"CommandLog(Size:%i)",getFileSize("Logs/Command.log"));
  1663.     format(alog[3],60,"ShootingLog(Size:%i)",getFileSize("Logs/Shooting.log"));
  1664.     format(alog[4],60,"DeathLog(Size:%i)",getFileSize("Logs/Death.log"));
  1665.     format(alog[5],60,"ConnectLog(Size:%i)",getFileSize("Logs/Connect.log"));
  1666.     format(alog[6],60,"DisconnectLog(Size:%i)",getFileSize("Logs/Disconnect.log"));
  1667.     format(alog[7],60,"InteriorLog(Size:%i)",getFileSize("Logs/Interior.log"));
  1668.     format(alog[8],60,"RconLoginLog(Size:%i)",getFileSize("Logs/RconLogin.log"));
  1669.     format(alog[9],60,"CarEnterLog(Size:%i)",getFileSize("Logs/CarEnter.log"));
  1670.     format(alog[10],60,"CarExitLog(Size:%i)",getFileSize("Logs/CarExit.log"));
  1671.     format(alog[11],60,"RconCommandLog(Size:%i)",getFileSize("Logs/RconCommand.log"));
  1672.     new abig[1200];
  1673.     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]);
  1674.     ShowPlayerDialog(playerid,SAVEMODE4_CHOOSE,DIALOG_STYLE_LIST,"Log clean",abig,"Confirm","Back");
  1675.     return 1;
  1676. }
  1677.  
  1678. stock cleanLog(playerid,logid)
  1679. {
  1680.     new logcl[125];
  1681.     switch(logid)
  1682.     {
  1683.         case 0:
  1684.         {
  1685.             format(logcl,125,"Are you sure that you want to clean the Position Log file(Size:%i)",getFileSize("Logs/Position.log"));
  1686.         }
  1687.         case 1:
  1688.         {
  1689.             format(logcl,125,"Are you sure that you want to clean the Chat Log file(Size:%i)",getFileSize("Logs/Chat.log"));
  1690.         }
  1691.         case 2:
  1692.         {
  1693.             format(logcl,125,"Are you sure that you want to clean the Command Log file(Size:%i)",getFileSize("Logs/Command.log"));
  1694.         }
  1695.         case 3:
  1696.         {
  1697.             format(logcl,125,"Are you sure that you want to clean the Shooting Log file(Size:%i)",getFileSize("Logs/Shooting.log"));
  1698.         }
  1699.         case 4:
  1700.         {
  1701.             format(logcl,125,"Are you sure that you want to clean the Death Log file(Size:%i)",getFileSize("Logs/Death.log"));
  1702.         }
  1703.         case 5:
  1704.         {
  1705.             format(logcl,125,"Are you sure that you want to clean the Connect Log file(Size:%i)",getFileSize("Logs/Connect.log"));
  1706.         }
  1707.         case 6:
  1708.         {
  1709.             format(logcl,125,"Are you sure that you want to clean the Disconnect Log file(Size:%i)",getFileSize("Logs/Disconnect.log"));
  1710.         }
  1711.         case 7:
  1712.         {
  1713.             format(logcl,125,"Are you sure that you want to clean the Interior Log file(Size:%i)",getFileSize("Logs/Interior.log"));
  1714.         }
  1715.         case 8:
  1716.         {
  1717.             format(logcl,125,"Are you sure that you want to clean the RconLogin Log file(Size:%i)",getFileSize("Logs/RconLogin.log"));
  1718.         }
  1719.         case 9:
  1720.         {
  1721.             format(logcl,125,"Are you sure that you want to clean the CarEnter Log file(Size:%i)",getFileSize("Logs/CarEnter.log"));
  1722.         }
  1723.         case 10:
  1724.         {
  1725.             format(logcl,125,"Are you sure that you want to clean the CarExit Log file(Size:%i)",getFileSize("Logs/CarExit.log"));
  1726.         }
  1727.         case 11:
  1728.         {
  1729.             format(logcl,125,"Are you sure that you want to clean the RconCommand Log file(Size:%i)",getFileSize("Logs/RconCommand.log"));
  1730.         }
  1731.     }
  1732.     ShowPlayerDialog(playerid,S4_CLEAN_CONNECT,DIALOG_STYLE_LIST,"Log clean",logcl,"Confirm","Back");
  1733.     return 1;
  1734. }
  1735.  
  1736. //PUBLICS (non-default)
  1737. forward LogLoc(playerid);
  1738. public LogLoc(playerid)
  1739. {
  1740.     new Float:X,Float:Y,Float:Z;
  1741.     GetPlayerPos(playerid,X,Y,Z);
  1742.     LogPlayerLocation(playerid,X,Y,Z);
  1743.     return 1;
  1744. }
  1745.  
  1746. forward LogCar(playerid);
  1747. public LogCar(playerid)
  1748. {
  1749.     InLog(playerid,GetPlayerVehicleSeat(playerid),GetPlayerVehicleID(playerid),GetVehicleModel(GetPlayerVehicleID(playerid)));
  1750.     return 1;
  1751. }
  1752.  
  1753. forward MyHttpResponse(index, response_code, data[]);
  1754. public MyHttpResponse(index, response_code, data[])
  1755. {
  1756.     if(!strcmp(data, VERSION, true))
  1757.     {
  1758.         print("[Logging System] The Logging filterscript needs an update.");
  1759.         printf("[Logging System] Latest Version: %s", data);
  1760.         printf("[Logging System] Your Version: %s", VERSION);
  1761.         print("[Logging System] Downloadlink: https://dl.dropboxusercontent.com/u/89362253/Log.zip");
  1762.     }
  1763.     else
  1764.     {
  1765.         print("[Logging System] The Logging system is up to date.");
  1766.     }
  1767.     return 1;
  1768. }
  1769.  
  1770. //COMMANDS
  1771. CMD:logmenu(playerid,params[])
  1772. {
  1773.     if(IsPlayerAdmin(playerid))
  1774.     {
  1775.         ShowPlayerDialog(playerid,LOGMENU,DIALOG_STYLE_LIST,"Logmenu","Configure logs\nClean logs","Confirm","Back");
  1776.     }
  1777.     return 1;
  1778. }
  1779.  
  1780. CMD:logenable(playerid,params[])
  1781. {
  1782.     if(IsPlayerAdmin(playerid))
  1783.     {
  1784.         new log;
  1785.         if(sscanf(params,"i",log))
  1786.         {
  1787.             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");
  1788.         }
  1789.         switch(log)
  1790.         {
  1791.             case 1:
  1792.             {
  1793.                 RconCommandLogging = 1;
  1794.                 dini_IntSet(FILE,"RconCommandLogging",1);
  1795.                 SendClientMessage(playerid,-1,"[Logging System] Rcon command logging diabled.");
  1796.             }
  1797.             case 2:
  1798.             {
  1799.                 ChatLogging = 1;
  1800.                 dini_IntSet(FILE,"ChatLogging",1);
  1801.                 SendClientMessage(playerid,-1,"[Logging System] Chat logging diabled.");
  1802.             }
  1803.             case 3:
  1804.             {
  1805.                 CommandLogging = 1;
  1806.                 dini_IntSet(FILE,"CommandLogging",1);
  1807.                 SendClientMessage(playerid,-1,"[Logging System] Command logging diabled.");
  1808.             }
  1809.             case 4:
  1810.             {
  1811.                 ShootingLogging = 1;
  1812.                 dini_IntSet(FILE,"ShootingLogging",1);
  1813.                 SendClientMessage(playerid,-1,"[Logging System] Shooting command logging diabled.");
  1814.             }
  1815.             case 5:
  1816.             {
  1817.                 PositionLogging = 1;
  1818.                 dini_IntSet(FILE,"PositionLogging",1);
  1819.                 SendClientMessage(playerid,-1,"[Logging System] Position command logging diabled.");
  1820.             }
  1821.             case 6:
  1822.             {
  1823.                 RconLoginLogging = 1;
  1824.                 dini_IntSet(FILE,"RconLoginLogging",1);
  1825.                 SendClientMessage(playerid,-1,"[Logging System] Rcon login logging diabled.");
  1826.             }
  1827.             case 7:
  1828.             {
  1829.                 DeathLogging = 1;
  1830.                 dini_IntSet(FILE,"DeathLogging",1);
  1831.                 SendClientMessage(playerid,-1,"[Logging System] Death logging diabled.");
  1832.             }
  1833.             case 8:
  1834.             {
  1835.                 ConnectLogging = 1;
  1836.                 dini_IntSet(FILE,"ConnectLogging",1);
  1837.                 SendClientMessage(playerid,-1,"[Logging System] Connect command logging diabled.");
  1838.             }
  1839.             case 9:
  1840.             {
  1841.                 DisconnectLogging = 1;
  1842.                 dini_IntSet(FILE,"DisconnectLogging",1);
  1843.                 SendClientMessage(playerid,-1,"[Logging System] Disconnect command logging diabled.");
  1844.             }
  1845.             case 10:
  1846.             {
  1847.                 InteriorLogging = 1;
  1848.                 dini_IntSet(FILE,"InteriorLogging",1);
  1849.                 SendClientMessage(playerid,-1,"[Logging System] Interior logging diabled.");
  1850.             }
  1851.             case 11:
  1852.             {
  1853.                 CarEnterLogging = 1;
  1854.                 dini_IntSet(FILE,"CarEnterLogging",1);
  1855.                 SendClientMessage(playerid,-1,"[Logging System] Car enter logging diabled.");
  1856.             }
  1857.             case 12:
  1858.             {
  1859.                 CarExitLogging = 1;
  1860.                 dini_IntSet(FILE,"CarExitLogging",1);
  1861.                 SendClientMessage(playerid,-1,"[Logging System] Car exit logging diabled.");
  1862.             }
  1863.             default:
  1864.             {
  1865.                 SendClientMessage(playerid, -1, "[Logging System] Your input was incorrect, try again.");
  1866.             }
  1867.         }
  1868.     }
  1869.     return 1;
  1870. }
  1871.  
  1872. CMD:logdisable(playerid,params[])
  1873. {
  1874.     if(IsPlayerAdmin(playerid))
  1875.     {
  1876.         new log;
  1877.         if(sscanf(params,"i",log))
  1878.         {
  1879.             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");
  1880.         }
  1881.         switch(log)
  1882.         {
  1883.             case 1:
  1884.             {
  1885.                 RconCommandLogging = 0;
  1886.                 dini_IntSet(FILE,"RconCommandLogging",0);
  1887.                 SendClientMessage(playerid,-1,"[Logging System] Rcon command logging diabled.");
  1888.             }
  1889.             case 2:
  1890.             {
  1891.                 ChatLogging = 0;
  1892.                 dini_IntSet(FILE,"ChatLogging",0);
  1893.                 SendClientMessage(playerid,-1,"[Logging System] Chat logging diabled.");
  1894.             }
  1895.             case 3:
  1896.             {
  1897.                 CommandLogging = 0;
  1898.                 dini_IntSet(FILE,"CommandLogging",0);
  1899.                 SendClientMessage(playerid,-1,"[Logging System] Command logging diabled.");
  1900.             }
  1901.             case 4:
  1902.             {
  1903.                 ShootingLogging = 0;
  1904.                 dini_IntSet(FILE,"ShootingLogging",0);
  1905.                 SendClientMessage(playerid,-1,"[Logging System] Shooting command logging diabled.");
  1906.             }
  1907.             case 5:
  1908.             {
  1909.                 PositionLogging = 0;
  1910.                 dini_IntSet(FILE,"PositionLogging",0);
  1911.                 SendClientMessage(playerid,-1,"[Logging System] Position command logging diabled.");
  1912.             }
  1913.             case 6:
  1914.             {
  1915.                 RconLoginLogging = 0;
  1916.                 dini_IntSet(FILE,"RconLoginLogging",0);
  1917.                 SendClientMessage(playerid,-1,"[Logging System] Rcon login logging diabled.");
  1918.             }
  1919.             case 7:
  1920.             {
  1921.                 DeathLogging = 0;
  1922.                 dini_IntSet(FILE,"DeathLogging",0);
  1923.                 SendClientMessage(playerid,-1,"[Logging System] Death logging diabled.");
  1924.             }
  1925.             case 8:
  1926.             {
  1927.                 ConnectLogging = 0;
  1928.                 dini_IntSet(FILE,"ConnectLogging",0);
  1929.                 SendClientMessage(playerid,-1,"[Logging System] Connect command logging diabled.");
  1930.             }
  1931.             case 9:
  1932.             {
  1933.                 DisconnectLogging = 0;
  1934.                 dini_IntSet(FILE,"DisconnectLogging",0);
  1935.                 SendClientMessage(playerid,-1,"[Logging System] Disconnect command logging diabled.");
  1936.             }
  1937.             case 10:
  1938.             {
  1939.                 InteriorLogging = 0;
  1940.                 dini_IntSet(FILE,"InteriorLogging",0);
  1941.                 SendClientMessage(playerid,-1,"[Logging System] Interior logging diabled.");
  1942.             }
  1943.             case 11:
  1944.             {
  1945.                 CarEnterLogging = 0;
  1946.                 dini_IntSet(FILE,"CarEnterLogging",0);
  1947.                 SendClientMessage(playerid,-1,"[Logging System] Car enter logging diabled.");
  1948.             }
  1949.             case 12:
  1950.             {
  1951.                 CarExitLogging = 0;
  1952.                 dini_IntSet(FILE,"CarExitLogging",0);
  1953.                 SendClientMessage(playerid,-1,"[Logging System] Car exit logging diabled.");
  1954.             }
  1955.             default:
  1956.             {
  1957.                 SendClientMessage(playerid, -1, "[Logging System] Your input was incorrect, try again.");
  1958.             }
  1959.         }
  1960.     }
  1961.     return 1;
  1962. }
  1963.  
  1964. CMD:loghelp(playerid, params[])
  1965. {
  1966.     SendClientMessage(playerid, -1, "-------------------[Logging System]-------------------");
  1967.     SendClientMessage(playerid, -1, "/loghelp: displays the helpmessages that u are looking at right now :P.");
  1968.     SendClientMessage(playerid, -1, "/logenable: enable specific logs.");
  1969.     SendClientMessage(playerid, -1, "/logdisable: disable specific logs.");
  1970.     return 1;
  1971. }
  1972.  
  1973. CMD:savemodeinfo(playerid,params[])
  1974. {
  1975.     SendClientMessage(playerid, -1 , "[Logging System] Savemode 1 will create a folder for every player and a logfile for every category (Example: JohnCena/Chat.log).");
  1976.     SendClientMessage(playerid, -1 , "[Logging System] Savemode 2 will save all information that has to be logged into per-player files (Example: JohnCena.log).");
  1977.     SendClientMessage(playerid, -1 , "[Logging System] Savemode 3 will save all information that has to be logged into a global logfile called 'Log.log'.");
  1978.     SendClientMessage(playerid, -1 , "[Logging System] Savemode 4 will save all information that has to be logged in seperate files foor every category (chat.log, rconcommand.log , ...).");
  1979.     return 1;
  1980. }
  1981.  
  1982. CMD:setpositionloginterval(playerid, params[])
  1983. {
  1984.     if(IsPlayerAdmin(playerid))
  1985.     {
  1986.         ShowPlayerDialog(playerid, SETPOSLOGINTERVAL, DIALOG_STYLE_INPUT, "Set position logging interval", "Enter a number between 1 and 'infinite' (you should enter at lest 500), the format is milliseconds","Confirm","Backs");
  1987.     }
  1988.     return 1;
  1989. }
  1990.  
  1991. CMD:logsavemode(playerid,params[])
  1992. {
  1993.     if(IsPlayerAdmin(playerid))
  1994.     {
  1995.         new log;
  1996.         if(sscanf(params,"i",log))
  1997.         {
  1998.             return SendClientMessage(playerid,-1,"[Logging System] Usage: /logsavemode [1/2/3/4] \n[Logging System] For information about the diffrent savemodes type /savemodeinfo");
  1999.         }
  2000.         switch(log)
  2001.         {
  2002.             case 1:
  2003.             {
  2004.                 SaveMode = 1;
  2005.                 dini_IntSet(FILE,"SaveMode",1);
  2006.                 SendClientMessage(playerid,-1,"[Logging System] Savemode has been set to 1.");
  2007.             }
  2008.             case 2:
  2009.             {
  2010.                 SaveMode = 2;
  2011.                 dini_IntSet(FILE,"SaveMode",2);
  2012.                 SendClientMessage(playerid,-1,"[Logging System] Savemode has been set to 2.");
  2013.             }
  2014.             case 3:
  2015.             {
  2016.                 SaveMode = 3;
  2017.                 dini_IntSet(FILE,"SaveMode",3);
  2018.                 SendClientMessage(playerid,-1,"[Logging System] Savemode has been set to 3.");
  2019.             }
  2020.             case 4:
  2021.             {
  2022.                 SaveMode = 4;
  2023.                 dini_IntSet(FILE,"SaveMode",4);
  2024.                 SendClientMessage(playerid,-1,"[Logging System] Savemode has been set to 4.");
  2025.             }
  2026.             default:
  2027.             {
  2028.                 SendClientMessage(playerid, -1, "[Logging System] Your input was incorrect, try again.");
  2029.             }
  2030.         }
  2031.         SendClientMessage(playerid, -1, "[Logging System] For information about the diffrent savemodes use /savemodeinfo");
  2032.     }
  2033.     return 1;
  2034. }
Advertisement
Add Comment
Please, Sign In to add comment