Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //===========================================//
- //** System : FilterScript Loading GTA SA ( http://forum.sa-mp.com/showthread.php?p=3882479 )
- //** Credits: Pedro Eduardo
- //===========================================//
- #include a_samp
- #include progress2
- #include zcmd
- #undef MAX_PLAYERS
- #define MAX_PLAYERS 20
- enum LoadEnum
- {
- timer_TD,
- timer_BAR,
- timer_DEBUG,
- poder
- };
- new
- Loading[MAX_PLAYERS][LoadEnum],
- PlayerText:P_TD_Load[MAX_PLAYERS],PlayerBar:Bar0[MAX_PLAYERS]
- ;
- public OnPlayerConnect(playerid)
- {
- P_TD_Load[playerid] = CreatePlayerTextDraw(playerid,0.0, 0.0, "_");
- PlayerTextDrawFont(playerid,P_TD_Load[playerid], 4);
- PlayerTextDrawUseBox(playerid,P_TD_Load[playerid], 1);
- PlayerTextDrawTextSize(playerid,P_TD_Load[playerid], 650.0, 470.0);
- Bar0[playerid] = CreatePlayerProgressBar(playerid, 53.000000, 427.000000, 183.000000, 3.699997, -1429936641, 100.0, 0);
- return 1;
- }
- forward Loading_Login_TD(playerid);
- public Loading_Login_TD(playerid)
- {
- new inicio[20],pdc = random(14);
- if(pdc == 0) inicio="loadsc1:loadsc1";
- else format(inicio,20,"loadsc%d:loadsc%d",pdc,pdc);
- PlayerTextDrawSetString(playerid, P_TD_Load[playerid], inicio);
- return 1;
- }
- forward Loading_Login_BAR(playerid);
- public Loading_Login_BAR(playerid)
- {
- if(GetPlayerProgressBarValue(playerid, Bar0[playerid]) >= 100.0) return TogglePlayerLoading(playerid, false),StopAudioStreamForPlayer(playerid);
- new pdc = random(20),time;
- KillTimer(Loading[playerid][timer_BAR]);
- if(pdc >= 19) time = 250;
- else if(pdc >= 10 && pdc < 19) time = 50;
- else time = 1;
- Loading[playerid][timer_BAR] = SetTimerEx("Loading_Login_BAR", time, true, "d", playerid);
- Loading[playerid][poder]++;
- SetPlayerProgressBarValue(playerid, Bar0[playerid],Loading[playerid][poder]);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- KillTimer(Loading[playerid][timer_TD]),
- KillTimer(Loading[playerid][timer_BAR]),
- KillTimer(Loading[playerid][timer_DEBUG]);
- return 1;
- }
- TogglePlayerLoading(playerid, bool:toggle)
- {
- if(toggle == true)
- {
- new inicio[20],pdc = random(14);
- if(pdc == 0) inicio="loadsc1:loadsc1";
- else format(inicio,20,"loadsc%d:loadsc%d",pdc,pdc);
- PlayerTextDrawSetString(playerid, P_TD_Load[playerid], inicio);
- Loading[playerid][timer_TD] = SetTimerEx("Loading_Login_TD", 2500, true, "d", playerid);
- Loading[playerid][timer_BAR] = SetTimerEx("Loading_Login_BAR", 1, true, "d", playerid);
- TogglePlayerSpectating(playerid, true);
- PlayerTextDrawShow(playerid, P_TD_Load[playerid]);
- ShowPlayerProgressBar(playerid, Bar0[playerid]);
- for(new i = 0; i < 20; i++) SendClientMessage(playerid, -1,"");
- }
- else
- {
- TogglePlayerSpectating(playerid, false);
- KillTimer(Loading[playerid][timer_TD]),
- KillTimer(Loading[playerid][timer_BAR]),
- KillTimer(Loading[playerid][timer_DEBUG]);
- PlayerTextDrawHide(playerid, P_TD_Load[playerid]);
- HidePlayerProgressBar(playerid, Bar0[playerid]);
- Loading[playerid][poder]=0;
- SetPlayerProgressBarValue(playerid, Bar0[playerid],Loading[playerid][poder]);
- }
- return 1;
- }
- forward Loading_Load(playerid);
- public Loading_Load(playerid) return TogglePlayerLoading(playerid, true);
- CMD:loading(playerid)
- {
- TogglePlayerLoading(playerid, false);
- Loading[playerid][timer_DEBUG] = SetTimerEx("Loading_Load", 1800, false, "d", playerid);
- PlayAudioStreamForPlayer(playerid, "http://allstar-rpg.esy.es/GTA%20SA%20Loading%20theme%202.mp3");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement