Advertisement
PedroEduardo

[FilterScript] Loading GTA SA

May 21st, 2017
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.74 KB | None | 0 0
  1. //===========================================//
  2. //** System : FilterScript Loading GTA SA    ( http://forum.sa-mp.com/showthread.php?p=3882479 )
  3. //** Credits: Pedro Eduardo                  
  4. //===========================================//
  5.  
  6. #include a_samp
  7. #include progress2
  8. #include zcmd
  9.  
  10. #undef  MAX_PLAYERS
  11. #define MAX_PLAYERS 20
  12.  
  13. enum LoadEnum
  14. {
  15.     timer_TD,
  16.     timer_BAR,
  17.     timer_DEBUG,
  18.     poder
  19. };
  20.  
  21. new
  22.     Loading[MAX_PLAYERS][LoadEnum],
  23.     PlayerText:P_TD_Load[MAX_PLAYERS],PlayerBar:Bar0[MAX_PLAYERS]
  24. ;
  25.  
  26. public OnPlayerConnect(playerid)
  27. {
  28.     P_TD_Load[playerid] = CreatePlayerTextDraw(playerid,0.0, 0.0, "_");
  29.     PlayerTextDrawFont(playerid,P_TD_Load[playerid], 4);
  30.     PlayerTextDrawUseBox(playerid,P_TD_Load[playerid], 1);
  31.     PlayerTextDrawTextSize(playerid,P_TD_Load[playerid], 650.0, 470.0);
  32.  
  33.     Bar0[playerid] = CreatePlayerProgressBar(playerid, 53.000000, 427.000000, 183.000000, 3.699997, -1429936641, 100.0, 0);
  34.     return 1;
  35. }
  36.  
  37. forward Loading_Login_TD(playerid);
  38. public Loading_Login_TD(playerid)
  39. {
  40.     new inicio[20],pdc = random(14);
  41.     if(pdc == 0) inicio="loadsc1:loadsc1";
  42.     else format(inicio,20,"loadsc%d:loadsc%d",pdc,pdc);
  43.  
  44.     PlayerTextDrawSetString(playerid, P_TD_Load[playerid], inicio);
  45.     return 1;
  46. }
  47.  
  48. forward Loading_Login_BAR(playerid);
  49. public Loading_Login_BAR(playerid)
  50. {
  51.     if(GetPlayerProgressBarValue(playerid, Bar0[playerid]) >= 100.0) return TogglePlayerLoading(playerid, false),StopAudioStreamForPlayer(playerid);
  52.  
  53.     new pdc = random(20),time;
  54.     KillTimer(Loading[playerid][timer_BAR]);
  55.     if(pdc >= 19)                  time = 250;
  56.     else if(pdc >= 10 && pdc < 19) time = 50;
  57.     else                           time = 1;
  58.  
  59.     Loading[playerid][timer_BAR] = SetTimerEx("Loading_Login_BAR", time, true, "d", playerid);
  60.     Loading[playerid][poder]++;
  61.     SetPlayerProgressBarValue(playerid, Bar0[playerid],Loading[playerid][poder]);
  62.     return 1;
  63. }
  64.  
  65. public OnPlayerDisconnect(playerid, reason)
  66. {
  67.     KillTimer(Loading[playerid][timer_TD]),
  68.     KillTimer(Loading[playerid][timer_BAR]),
  69.     KillTimer(Loading[playerid][timer_DEBUG]);
  70.     return 1;
  71. }
  72.  
  73. TogglePlayerLoading(playerid, bool:toggle)
  74. {
  75.     if(toggle == true)
  76.     {
  77.         new inicio[20],pdc = random(14);
  78.         if(pdc == 0) inicio="loadsc1:loadsc1";
  79.         else format(inicio,20,"loadsc%d:loadsc%d",pdc,pdc);
  80.  
  81.         PlayerTextDrawSetString(playerid, P_TD_Load[playerid], inicio);
  82.  
  83.         Loading[playerid][timer_TD] = SetTimerEx("Loading_Login_TD", 2500, true, "d", playerid);
  84.         Loading[playerid][timer_BAR] = SetTimerEx("Loading_Login_BAR", 1, true, "d", playerid);
  85.  
  86.         TogglePlayerSpectating(playerid, true);
  87.         PlayerTextDrawShow(playerid, P_TD_Load[playerid]);
  88.         ShowPlayerProgressBar(playerid, Bar0[playerid]);
  89.         for(new i = 0; i < 20; i++) SendClientMessage(playerid, -1,"");
  90.     }
  91.     else
  92.     {
  93.         TogglePlayerSpectating(playerid, false);
  94.  
  95.         KillTimer(Loading[playerid][timer_TD]),
  96.         KillTimer(Loading[playerid][timer_BAR]),
  97.         KillTimer(Loading[playerid][timer_DEBUG]);
  98.  
  99.         PlayerTextDrawHide(playerid, P_TD_Load[playerid]);
  100.         HidePlayerProgressBar(playerid, Bar0[playerid]);
  101.  
  102.         Loading[playerid][poder]=0;
  103.         SetPlayerProgressBarValue(playerid, Bar0[playerid],Loading[playerid][poder]);
  104.     }
  105.     return 1;
  106. }
  107.  
  108. forward Loading_Load(playerid);
  109. public Loading_Load(playerid) return TogglePlayerLoading(playerid, true);
  110.  
  111. CMD:loading(playerid)
  112. {
  113.     TogglePlayerLoading(playerid, false);
  114.  
  115.     Loading[playerid][timer_DEBUG] = SetTimerEx("Loading_Load", 1800, false, "d", playerid);
  116.     PlayAudioStreamForPlayer(playerid, "http://allstar-rpg.esy.es/GTA%20SA%20Loading%20theme%202.mp3");
  117.     return 1;
  118. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement