Guest User

Untitled

a guest
May 23rd, 2016
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.62 KB | None | 0 0
  1. // ▄▄▄▄▄
  2. // █ █
  3. // ▄▄▄ █ █ ▄▄▄▄▄ ░ ▄▄▄░ ░▄▄▄░
  4. // █ █ █ █▄▄▄▄█ █░░░█ █░░░█
  5. // █ █ █ █▀▀▀▀█ █▀▀▀█ █▀▀█▀
  6. // ▀▀▀ ▀▀▀▀▀ ▀▀▀▀▀ ▀░░░▀ ▀░░░▀ cDbar.inc v1.0
  7. // Owner: coDemo
  8. // Please don't change credits
  9. #include <YSI\y_hooks>
  10.  
  11. forward cD_OnProgressBarEnd(playerid);
  12. #define cD_function:%0(%1) forward %0(%1); public %0(%1)
  13. #define cD.%0[%1] cD_bar[%1][%0]
  14.  
  15. enum cD_barE
  16. {
  17. cD_timer,
  18. cD_value
  19. }
  20. new
  21. cD_bar[MAX_PLAYERS][cD_barE],
  22. Text:cDbar_TD [ 2 ],
  23. PlayerText:cDbar_pTD [ MAX_PLAYERS ] [ 2 ]
  24. ;
  25.  
  26. hook OnGameModeInit()
  27. {
  28. cDbar_TD [ 0 ] = TextDrawCreate(458.000000, 400.000000, "BG");
  29. TextDrawBackgroundColor(cDbar_TD [ 0 ], 255);
  30. TextDrawFont(cDbar_TD [ 0 ], 1);
  31. TextDrawLetterSize(cDbar_TD [ 0 ], 0.000000, 1.000000);
  32. TextDrawColor(cDbar_TD [ 0 ], -1);
  33. TextDrawSetOutline(cDbar_TD [ 0 ], 0);
  34. TextDrawSetProportional(cDbar_TD [ 0 ], 1);
  35. TextDrawSetShadow(cDbar_TD [ 0 ], 1);
  36. TextDrawUseBox(cDbar_TD [ 0 ], 1);
  37. TextDrawBoxColor(cDbar_TD [ 0 ], 117901311);
  38. TextDrawTextSize(cDbar_TD [ 0 ], 196.000000, 0.000000);
  39. TextDrawSetSelectable(cDbar_TD [ 0 ], 0);
  40.  
  41. cDbar_TD [ 1 ] = TextDrawCreate(456.500000, 401.500000, "BG");
  42. TextDrawBackgroundColor(cDbar_TD [ 1 ], 255);
  43. TextDrawFont(cDbar_TD [ 1 ], 1);
  44. TextDrawLetterSize(cDbar_TD [ 1 ], 0.000000, 0.650000);
  45. TextDrawColor(cDbar_TD [ 1 ], -1);
  46. TextDrawSetOutline(cDbar_TD [ 1 ], 0);
  47. TextDrawSetProportional(cDbar_TD [ 1 ], 1);
  48. TextDrawSetShadow(cDbar_TD [ 1 ], 1);
  49. TextDrawUseBox(cDbar_TD [ 1 ], 1);
  50. TextDrawBoxColor(cDbar_TD [ 1 ], 769880181);
  51. TextDrawTextSize(cDbar_TD [ 1 ], 197.000000, 0.000000);
  52. TextDrawSetSelectable(cDbar_TD [ 1 ], 0);
  53. return 1;
  54. }
  55.  
  56. hook OnPlayerConnect(playerid)
  57. {
  58. cD.cD_value[playerid] = 0;
  59. cDbar_pTD [ playerid ] [ 0 ] = CreatePlayerTextDraw(playerid, 200.500000, 401.500000, "bar");
  60. PlayerTextDrawBackgroundColor(playerid, cDbar_pTD [ playerid ] [ 0 ], 255);
  61. PlayerTextDrawFont(playerid, cDbar_pTD [ playerid ] [ 0 ], 1);
  62. PlayerTextDrawLetterSize(playerid, cDbar_pTD [ playerid ] [ 0 ], 0.000000, 0.650000);
  63. PlayerTextDrawColor(playerid, cDbar_pTD [ playerid ] [ 0 ], -1);
  64. PlayerTextDrawSetOutline(playerid, cDbar_pTD [ playerid ] [ 0 ], 0);
  65. PlayerTextDrawSetProportional(playerid, cDbar_pTD [ playerid ] [ 0 ], 1);
  66. PlayerTextDrawSetShadow(playerid, cDbar_pTD [ playerid ] [ 0 ], 1);
  67. PlayerTextDrawUseBox(playerid, cDbar_pTD [ playerid ] [ 0 ], 1);
  68. PlayerTextDrawBoxColor(playerid, cDbar_pTD [ playerid ] [ 0 ], 769880234);
  69. PlayerTextDrawTextSize(playerid, cDbar_pTD [ playerid ] [ 0 ], 413.000000, 0.000000);
  70. PlayerTextDrawSetSelectable(playerid, cDbar_pTD [ playerid ] [ 0 ], 0);
  71.  
  72. cDbar_pTD [ playerid ] [ 1 ] = CreatePlayerTextDraw(playerid, 198.000000, 386.500000, "Jusu tekstas");
  73. PlayerTextDrawBackgroundColor(playerid, cDbar_pTD [ playerid ] [ 1 ], 255);
  74. PlayerTextDrawFont(playerid, cDbar_pTD [ playerid ] [ 1 ], 2);
  75. PlayerTextDrawLetterSize(playerid, cDbar_pTD [ playerid ] [ 1 ], 0.224999, 1.200000);
  76. PlayerTextDrawColor(playerid, cDbar_pTD [ playerid ] [ 1 ], -1);
  77. PlayerTextDrawSetOutline(playerid, cDbar_pTD [ playerid ] [ 1 ], 1);
  78. PlayerTextDrawSetProportional(playerid, cDbar_pTD [ playerid ] [ 1 ], 1);
  79. PlayerTextDrawSetSelectable(playerid, cDbar_pTD [ playerid ] [ 1 ], 0);
  80. return 1;
  81. }
  82.  
  83. hook OnPlayerDisconnect(playerid, reason)
  84. {
  85. if(IsBarActive(playerid)) return cD_KillBar(playerid);
  86. return 1;
  87. }
  88.  
  89. stock cD_StartBar(playerid, text[], time)
  90. {
  91. for(new TD; TD < sizeof cDbar_TD; TD++) TextDrawShowForPlayer(playerid, cDbar_TD[TD]);
  92. return PlayerTextDrawSetString(playerid, cDbar_pTD [ playerid ] [ 1 ], text), PlayerTextDrawShow(playerid, cDbar_pTD [ playerid ] [ 1 ]), cD.cD_timer[playerid] = SetTimerEx("cD_updateBar", time/100, 1, "i", playerid);
  93. }
  94.  
  95. stock cD_KillBar(playerid)
  96. {
  97. cD.cD_value[playerid] = 0, KillTimer(cD.cD_timer[playerid]);
  98. for(new TD; TD < sizeof cDbar_TD; TD++) TextDrawHideForPlayer(playerid, cDbar_TD[TD]);
  99. return PlayerTextDrawHide(playerid, cDbar_pTD [ playerid ] [ 0 ]), PlayerTextDrawHide(playerid, cDbar_pTD [ playerid ] [ 1 ]);
  100. }
  101.  
  102. stock IsBarActive(playerid) return cD.cD_value[playerid];
  103.  
  104. cD_function:cD_updateBar(playerid)
  105. {
  106. cD.cD_value[playerid] ++, PlayerTextDrawTextSize(playerid, cDbar_pTD [ playerid ] [ 0 ], 197+(2.56*cD.cD_value[playerid]), 0.000000), PlayerTextDrawShow(playerid, cDbar_pTD [ playerid ] [ 0 ]);
  107. if(cD.cD_value[playerid] == 100) return cD_KillBar(playerid), CallLocalFunction("cD_OnProgressBarEnd", "i", playerid);
  108. return 1;
  109. }
Advertisement
Add Comment
Please, Sign In to add comment