Guest User

My 2nd FS

a guest
Jun 19th, 2014
491
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1.  
  2. // countdown
  3.  
  4. #include <a_samp>
  5.  
  6.  
  7. #define countdownountdown_dialog 1031
  8. #define MAX_Input_Countdown 50
  9. new bool:Cstats[MAX_PLAYERS];
  10. new timer;
  11.  
  12. enum var{nn};new Variable[var];
  13.  
  14.  
  15.  
  16. public OnFilterScriptInit()
  17. {
  18. print("\n--------------------------------------");
  19. print(" MAX_Input_Countdown enjoy ! ");
  20. print("--------------------------------------\n");
  21. return 1;
  22. }
  23.  
  24. public OnFilterScriptExit()
  25. {
  26. return 1;
  27. }
  28.  
  29. main()
  30. {
  31.  
  32. }
  33.  
  34. public OnPlayerConnect(playerid)
  35. {
  36.  
  37. return 1;
  38. }
  39.  
  40. public OnPlayerDisconnect(playerid, reason)
  41. {
  42. Cstats[playerid] = false;
  43. return 1;
  44. }
  45.  
  46. public OnPlayerCommandText(playerid, cmdtext[])
  47. {
  48. if (strcmp("/try", cmdtext, true, 3) == 0)
  49. {
  50. countdown(playerid);
  51. return 1;
  52. }
  53. return 0;
  54. }
  55.  
  56. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  57. {
  58. if(dialogid == countdownountdown_dialog)
  59. {
  60. if(!response)
  61. {
  62. Cstats[playerid] = false;
  63.  
  64. }
  65. else
  66. {
  67. new string[24];
  68. Variable[nn] = strval(inputtext);
  69. if ( Variable[nn] > MAX_Input_Countdown )
  70. {
  71. SendClientMessage(playerid, 0xFF0000FF, "ERROR MAX Countdown is exceed");
  72. Cstats[playerid] = false;
  73. countdown(playerid);
  74. return 1;
  75. }
  76. else
  77. {
  78. format( string, sizeof(string), "~y~%i",Variable[nn]);
  79. GameTextForAll( string , 5000, 3 );
  80. timer = SetTimer("count", 1000, true);
  81. Cstats[playerid] = false;
  82. }
  83.  
  84.  
  85. }
  86. return 1;
  87. }
  88.  
  89. return 0;
  90. }
  91.  
  92. forward count(); public count() {
  93. new string[24];
  94. if(Variable[nn] == 0)
  95. {
  96. KillTimer(timer);
  97. GameTextForAll( "goo" , 5000, 3 );
  98. return 1;
  99. }
  100. Variable[nn] --;
  101. format( string, sizeof(string), "~y~%i" ,Variable[nn]);
  102. GameTextForAll( string , 5000, 3 );
  103. return 1;
  104. }
  105.  
  106. countdown(playerid)
  107. {
  108. if(Cstats[playerid] == true) return SendClientMessage(playerid, 0xFF0000FF, "ERROR CMD ");
  109. ShowPlayerDialog(playerid, countdownountdown_dialog, DIALOG_STYLE_INPUT, "{FF0000}countdownountdown", " switch {00FF00} any number at secondes(sec) ", "O", "X");
  110. Cstats[playerid] = true;
  111. return 1;
  112. }
  113.  
  114.  
  115. // By Golf
Advertisement
Add Comment
Please, Sign In to add comment