Ghecco

ScreenFade

Jun 9th, 2020
89
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. stock ScreenFade_Carica(playerid)// Da inserire su OnPlayerConnect
  2. {
  3.     Background[playerid] = CreatePlayerTextDraw(playerid, 320, 0, "_");
  4.     PlayerTextDrawUseBox(playerid, Background[playerid], 1);
  5.     PlayerTextDrawLetterSize(playerid, Background[playerid], 1.0, 49.6);
  6.     PlayerTextDrawTextSize(playerid, Background[playerid], 1.0, 640);
  7.     PlayerTextDrawBoxColor(playerid, Background[playerid], 0x00000000);
  8.     PlayerTextDrawAlignment(playerid, Background[playerid], 2);
  9.     return 1;
  10. }
  11.  
  12. stock ScreenFade(playerid) // Funzione
  13. {
  14.     SetTimerEx("FadeOut", DELAY, false, "id", playerid, 0);
  15.     return 1;
  16. }
  17.  
  18. forward FadeOut(playerid, A); // Trasparenza da 0 a totale
  19. public FadeOut(playerid, A)
  20. {
  21.    
  22.     PlayerTextDrawBoxColor(playerid, Background[playerid], RGBToHex(0,0,0,A));
  23.     PlayerTextDrawShow(playerid, Background[playerid]);
  24.     if (A == 255) SetTimerEx("FadeOut", DELAY, false, "id", playerid, A+1);
  25.     else if( A == 0) SetTimerEx("FadeIn", DELAY, false, "id", playerid, 255);
  26.     return 1;
  27. }
  28.  
  29. forward FadeIn(playerid, A); // Trasparenza da 255 a 0
  30. public FadeIn(playerid, A)
  31. {
  32.     PlayerTextDrawBoxColor(playerid, Background[playerid], RGBToHex(0,0,0,A));
  33.     PlayerTextDrawShow(playerid, Background[playerid]);
  34.     if(A > 1) SetTimerEx("FadeIn", DELAY, false, "id", playerid, A-1);
  35.     else PlayerTextDrawHide(playerid, Background[playerid]);
  36.     return 1;
  37. }
RAW Paste Data