Guest User

Seif

a guest
Aug 28th, 2008
726
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.71 KB | None | 0 0
  1. /*
  2.                             Seifader - Screen Fader by Seif
  3. */
  4. /*x---------------------------------Important-------------------------------------x*/
  5. //**INCLUDES**//
  6. #include <a_samp>
  7. //**PRAGMAS**//
  8.  
  9. //**MISC**//
  10.  
  11. /*x---------------------------------Defining-------------------------------------x*/
  12. //**COLORS*//
  13.  
  14.     //Some colors I made
  15. /*#define GREEN             0x21DD00FF
  16. #define RED             0xE60000FF
  17. #define ADMIN_RED       0xFB0000FF
  18. #define YELLOW          0xFFFF00FF
  19. #define ORANGE          0xF97804FF
  20. #define LIGHTRED        0xFF8080FF
  21. #define LIGHTBLUE       0x00C2ECFF
  22. #define PURPLE          0xB360FDFF
  23. #define BLUE            0x1229FAFF
  24. #define LIGHTGREEN      0x38FF06FF
  25. #define DARKPINK        0xE100E1FF
  26. #define DARKGREEN       0x008040FF
  27. #define ANNOUNCEMENT    0x6AF7E1FF
  28. #define GREY            0xCECECEFF
  29. #define PINK            0xD52DFFFF
  30. #define DARKGREY        0x626262FF
  31. #define AQUAGREEN       0x03D687FF
  32. #define WHITE           0xFFFFFFFF*/
  33. //**MISC**//
  34.  
  35. //**VARIABLES**//
  36. new colorfade[MAX_PLAYERS];
  37. new Text:screenfade[MAX_PLAYERS];
  38. // **FORWARDS** //
  39. forward ScreenFade(playerid, color, speed);
  40. forward ScreenFadeColor(playerid, color, speed);
  41. forward OnPlayerScreenFade(playerid, color, speed);
  42. forward OnPlayerScreenColorFade(playerid, color, speed);
  43. // **NATIVES** //
  44. /*
  45.     native Seifader_OnInit();
  46.     native Seifader_OnExit();
  47.     native FadePlayerScreen(playerid, color, speed);
  48.     native FadePlayerScreenToColor(playerid, color, speed);
  49.     native Seifader_OnPlayerDisconnect(playerid, reason);
  50. */
  51. /*x---------------------------------CallBacks-------------------------------------x*/
  52. stock Seifader_OnInit()
  53. {
  54.     for(new all = 0; all < MAX_PLAYERS; all++)
  55.     {
  56.         screenfade[all] = TextDrawCreate(0.0, 0.0, "_");
  57.         TextDrawFont(screenfade[all], 1);
  58.         TextDrawLetterSize(screenfade[all], 0.0, 50.0);
  59.         TextDrawUseBox(screenfade[all], true);
  60.         TextDrawColor(screenfade[all], 0);
  61.         TextDrawBoxColor(screenfade[all], 0);
  62.         colorfade[all] = 0;
  63.     }
  64. }
  65.  
  66. stock Seifader_OnExit()
  67. {
  68.     for(new all = 0; all < MAX_PLAYERS; all++) TextDrawDestroy(screenfade[all]);
  69. }
  70.  
  71. stock Seifader_OnPlayerDisconnect(playerid, reason)
  72. {
  73.     TextDrawHideForPlayer(playerid, screenfade[playerid]);
  74. }
  75.  
  76. stock FadePlayerScreen(playerid, color, speed)
  77. {
  78.     colorfade[playerid] = color;
  79.     TextDrawBoxColor(screenfade[playerid], color);
  80.     TextDrawShowForPlayer(playerid, screenfade[playerid]);
  81.     SetTimerEx("ScreenFade", 100, 0, "ddd", playerid, color, speed);
  82. }
  83.  
  84. stock FadePlayerScreenToColor(playerid, color, speed)
  85. {
  86.     color -= 255;
  87.     colorfade[playerid] = color;
  88.     TextDrawBoxColor(screenfade[playerid], color);
  89.     TextDrawShowForPlayer(playerid, screenfade[playerid]);
  90.     SetTimerEx("ScreenFadeColor", 100, 0, "ddd", playerid, color, speed);
  91. }
  92.  
  93. public ScreenFade(playerid, color, speed)
  94. {
  95.     if (color <= (colorfade[playerid] - 255))
  96.     {
  97.         TextDrawHideForPlayer(playerid, screenfade[playerid]);
  98.         OnPlayerScreenFade(playerid, color, speed);
  99.     }
  100.     else
  101.     {
  102.         color -= speed;
  103.         if (color <= (colorfade[playerid] - 255)) color = (colorfade[playerid] - 255);
  104.         TextDrawBoxColor(screenfade[playerid], color);
  105.         TextDrawShowForPlayer(playerid, screenfade[playerid]);
  106.         SetTimerEx("ScreenFade", 100, 0, "ddd", playerid, color, speed);
  107.     }
  108. }
  109.  
  110. public ScreenFadeColor(playerid, color, speed)
  111. {
  112.     if (color >= (colorfade[playerid] + 255))
  113.     {
  114.         OnPlayerScreenColorFade(playerid, color, speed);
  115.     }
  116.     else
  117.     {
  118.         color += speed;
  119.         if (color >= (colorfade[playerid] + 255)) return;
  120.         TextDrawBoxColor(screenfade[playerid], color);
  121.         TextDrawShowForPlayer(playerid, screenfade[playerid]);
  122.         SetTimerEx("ScreenFadeColor", 100, 0, "ddd", playerid, color, speed);
  123.     }
  124. }
  125.  
  126. /*public OnPlayerScreenFade(playerid, color, speed)
  127. {
  128.     return 1;
  129. }
  130.  
  131. public OnPlayerScreenColorFade(playerid, color, speed)
  132. {
  133.     return 1;
  134. }*/
Advertisement
Add Comment
Please, Sign In to add comment