Guest User

Simple Players Count + Record System v1.2

a guest
Apr 5th, 2016
163
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Credits:-
  3. Samp team For a_samp Include
  4. DTV For His Mini Help To Fix The TextDraw Error
  5. Me For The Script
  6. */
  7. #include a_samp
  8. #include Dini
  9.  
  10. new Text:pcounter;
  11. new TimerRecord;
  12. new PlayerCount;
  13. new str[128];
  14.  
  15. #undef MAX_PLAYERS
  16. #define MAX_PLAYERS 100
  17. #define recordfile "precord.ini"
  18.  
  19. forward ConnectingOfPlayer();
  20.  
  21. public OnFilterScriptInit()
  22. {
  23. new string[8];
  24. format(string,sizeof(string),"%d/%d",PlayerCount,MAX_PLAYERS);
  25. pcounter = TextDrawCreate(309.000000, 9.000000, string);
  26. TextDrawAlignment(pcounter, 2);
  27. TextDrawBackgroundColor(pcounter, 255);
  28. TextDrawFont(pcounter, 1);
  29. TextDrawLetterSize(pcounter, 0.500000, 1.500000);
  30. TextDrawColor(pcounter, -1);
  31. TextDrawSetOutline(pcounter, 1);
  32. TextDrawSetProportional(pcounter, 1);
  33. if(!dini_Exists(recordfile))
  34. {
  35.       dini_Create(recordfile);
  36.       printf("File (%s) is made .",recordfile);
  37. }
  38. dini_IntSet(recordfile,"precord",0);
  39. TimerRecord = SetTimer("precord",180000,true);
  40. return 1;
  41. }
  42.  
  43. public OnFilterScriptExit()
  44. {
  45.         KillTimer(TimerRecord);
  46.         return 1;
  47. }
  48.  
  49. forward record(playerid);
  50. public record(playerid)
  51. {
  52.         new     recordplayer = dini_Int(recordfile,"precord");
  53.         new connecting = ConnectingOfPlayer();
  54.         if(recordplayer < connecting)
  55.         {
  56.             dini_IntSet(recordfile,"precord",connecting);
  57.             format(str,sizeof(str),"Max  ever players online is: [%d]",connecting);
  58.             SendClientMessageToAll(0x33AA33AA,str);
  59.         } else {
  60.             new starirecord = dini_Int(recordfile,"precord");
  61.             format(str,sizeof(str),"Max ever player online is [%d] ",starirecord);
  62.             SendClientMessageToAll(0x33AA33AA,str);
  63.         }
  64.         return 1;
  65. }
  66.  
  67. public OnPlayerConnect(playerid)
  68. {
  69.         PlayerCount ++;
  70.         TextDrawShowForPlayer(playerid, pcounter);
  71.         return 1;
  72. }
  73.  
  74. public OnPlayerDisconnect(playerid, reason)
  75. {
  76.         PlayerCount --;
  77.         return 1;
  78. }
  79.  
  80.  
  81. public ConnectingOfPlayer()
  82. {
  83.         new Connected;
  84.         for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) Connected++;
  85.         return Connected;
  86. }
RAW Paste Data