Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2015
890
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. #include <a_samp>
  2. #include <Dini>
  3. #define recordfile "record.txt"
  4. new str[128];
  5. new TimerRecord;
  6. new PlayerCount;
  7. #define FILTERSCRIPT
  8. forward ConnectingOfPlayer();
  9.  
  10.  
  11. public OnFilterScriptInit()
  12. {
  13. print("\n-------------------------------------------------");
  14. print("");
  15. print("-------------------------------------------------\n");
  16. if(!dini_Exists(recordfile))
  17. {
  18. dini_Create(recordfile);
  19. printf("File (%s) is made .",recordfile);
  20. }
  21. dini_IntSet(recordfile,"record",0);
  22. TimerRecord = SetTimer("record",180000,true);
  23. return 1;
  24. }
  25.  
  26. public OnFilterScriptExit()
  27. {
  28. KillTimer(TimerRecord);
  29. return 1;
  30. }
  31.  
  32. forward record(playerid);
  33. public record(playerid)
  34. {
  35. new recordplayer = dini_Int(recordfile,"record");
  36. new connecting = ConnectingOfPlayer();
  37. if(recordplayer < connecting)
  38. {
  39. dini_IntSet(recordfile,"record",connecting);
  40. format(str,sizeof(str),"Max ever players online is: [%d]",connecting);
  41. SendClientMessageToAll(0x33AA33AA,str);
  42. } else {
  43. new starirecord = dini_Int(recordfile,"record");
  44. format(str,sizeof(str),"Max ever player online is [%d] ",starirecord);
  45. SendClientMessageToAll(0x33AA33AA,str);
  46. }
  47. return 1;
  48. }
  49.  
  50. public OnPlayerCommandText(playerid, cmdtext[])
  51. {
  52. if (strcmp("/online", cmdtext, true, 10) == 0)
  53. {
  54. format(str,sizeof(str),"Online players: [%d]",PlayerCount);
  55. SendClientMessage(playerid,-1,str);
  56. return 1;
  57. }
  58. return 0;
  59. }
  60.  
  61.  
  62.  
  63. public OnPlayerConnect(playerid)
  64. {
  65. PlayerCount ++;
  66. return 1;
  67. }
  68.  
  69. public OnPlayerDisconnect(playerid, reason)
  70. {
  71. PlayerCount --;
  72. return 1;
  73. }
  74.  
  75. public OnPlayerSpawn(playerid)
  76. {
  77. if(PlayerCount > 10)
  78. {
  79. SendClientMessage(playerid,-1,"There are more than 10 players online!");
  80. }
  81. return 1;
  82. }
  83.  
  84. public ConnectingOfPlayer()
  85. {
  86. new Connected;
  87. for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) Connected++;
  88. return Connected;
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement