Guest User

Online i rekord problem!!!!!

a guest
Jun 28th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. #include <a_samp>
  2. #include <foreach>
  3.  
  4. #define TDSFP TextDrawShowForPlayer
  5.  
  6. //================================New's=========================================
  7. new onlinepl, postojecirekord;
  8. new Text:OnlineRecord;
  9. //==============================================================================
  10. public OnFilterScriptInit()
  11. {
  12. DosadasnjiRekord();
  13. onlinepl=Konektovano();
  14.  
  15. OnlineRecord = TextDrawCreate(566.000122, 204.503677, "online: ~w~100");
  16. TextDrawLetterSize(OnlineRecord, 0.252333, 1.334518);
  17. TextDrawAlignment(OnlineRecord, 1);
  18. TextDrawColor(OnlineRecord, 16711935);
  19. TextDrawSetShadow(OnlineRecord, 0);
  20. TextDrawSetOutline(OnlineRecord, 1);
  21. TextDrawBackgroundColor(OnlineRecord, 51);
  22. TextDrawFont(OnlineRecord, 3);
  23. TextDrawSetProportional(OnlineRecord, 1);
  24.  
  25. print("\n--------------------------------------");
  26. print(" RAPlaY's Online i Rekord FS");
  27. print("--------------------------------------\n");
  28. return 1;
  29. }
  30.  
  31. public OnFilterScriptExit()
  32. {
  33. return 1;
  34. }
  35.  
  36. public OnPlayerConnect(playerid)
  37. {
  38. SetTimerEx("RekordTimer", 3000, false, "d", playerid);
  39. return 1;
  40. }
  41.  
  42. public OnPlayerDisconnect(playerid, reason)
  43. {
  44. onlinepl--;
  45. return 1;
  46. }
  47.  
  48. public OnPlayerSpawn(playerid)
  49. {
  50. TDSFP(playerid, OnlineRecord);
  51. return 1;
  52. }
  53. ///////////////////////////////////////////////////////////////////////////
  54. forward DosadasnjiRekord();
  55. public DosadasnjiRekord()
  56. {
  57. new strFromFile[24], arrCoords[6][5], File: file = fopen("rekord.txt", io_read);
  58. if (file)
  59. {
  60. fread(file, strFromFile);
  61. razdvoji(strFromFile, arrCoords, ',');
  62. postojecirekord = strval(arrCoords[0]);
  63. fclose(file);
  64. }
  65. return 1;
  66. }
  67. forward SacuvajRekord();
  68. public SacuvajRekord()
  69. {
  70. new File: file = fopen("rekord.txt", io_write);
  71. fclose(file);
  72. return 1;
  73. }
  74. forward RekordTimer(playerid);
  75. public RekordTimer(playerid)
  76. {
  77. if(postojecirekord)
  78.  
  79. onlinepl++;
  80. if(postojecirekord < onlinepl)
  81. {
  82. postojecirekord=onlinepl;
  83. SacuvajRekord();
  84. }
  85. return 1;
  86. }
  87. stock razdvoji(const strsrc[], strdest[][], delimiter)
  88. {
  89. new i, li;
  90. new aNum;
  91. new len;
  92. while(i <= strlen(strsrc))
  93. {
  94. if(strsrc[i] == delimiter || i == strlen(strsrc))
  95. {
  96. len = strmid(strdest[aNum], strsrc, li, i, 128);
  97. strdest[aNum][len] = 0;
  98. li = i+1;
  99. aNum++;
  100. }
  101. i++;
  102. }
  103. return 1;
  104. }
  105. forward Konektovano();
  106. public Konektovano()
  107. {
  108. new Connected;
  109. for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && !IsPlayerNPC(i)) Connected++;
  110. return Connected;
  111. }
Advertisement
Add Comment
Please, Sign In to add comment