fmdmonthlycount.inc 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. FMD Monthly call count reset system. ~$kylar
  3. */
  4. // A variable that checks whether or not the callcounts should be reset //
  5. static bool:_FMDCallResetFlag = true;
  6. // A function that checks if it's the first day of the month //
  7. AutoResetCallCount(){
  8. // Variable to store the day, month and year. Most of them are redundant except for day //
  9. new
  10. day,
  11. month,
  12. year;
  13. // Actually fetching the data //
  14. getdate(year, month, day);
  15. // If day is the first of the month //
  16. if(day == 1){
  17. // If the flag is true then the counts are reset //
  18. if(_FMDCallResetFlag){
  19. // Setting the flag to false so that it does not reset it again in that very same day if it's checked again //
  20. _FMDCallResetFlag = false;
  21. // looping though all the players and resetting the monthly call count variable //
  22. foreach(new i: Player)
  23. PlayerInfo[i][pMonthlyCallCount] = 0;
  24. // Sending a query to reset all monthly call count coloumn in the database //
  25. mysql_pquery(sqlGameConnection, "UPDATE `players` SET `MonthlyMedicCount` = 0");
  26. }
  27. }
  28. // If it's not the first of the month
  29. else{
  30. // If the flag is set to false
  31. if(!_FMDCallResetFlag){
  32. // Set it to true so that if the first day of the month happens again then it triggers the reset //
  33. _FMDCallResetFlag = true;
  34. }
  35. }
  36. return 1;
  37. }