Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define DELAY 5
- #define RGBToHex(%0,%1,%2,%3) %0 << 24 | %1 << 16 | %2 << 8 | %3
- new PlayerText:Background[MAX_PLAYERS];
- new bool:IsPlayerDead[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- for (new playerid = 0; playerid < MAX_PLAYERS; playerid++)
- {
- if (IsPlayerConnected(playerid)) OnPlayerConnect(playerid);
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- Background[playerid] = CreatePlayerTextDraw(playerid, 320, 0, "_");
- PlayerTextDrawUseBox(playerid, Background[playerid], 1);
- PlayerTextDrawLetterSize(playerid, Background[playerid], 1.0, 49.6);
- PlayerTextDrawTextSize(playerid, Background[playerid], 1.0, 640);
- PlayerTextDrawBoxColor(playerid, Background[playerid], 0x00000000);
- PlayerTextDrawAlignment(playerid, Background[playerid], 2);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if (IsPlayerDead[playerid]) return 1;
- IsPlayerDead[playerid] = true;
- SetTimerEx("FadeOut", DELAY, false, "id", playerid, 0);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- IsPlayerDead[playerid] = false;
- SetTimerEx("FadeIn", DELAY, false, "id", playerid, 255);
- return 1;
- }
- forward FadeOut(playerid, A);
- public FadeOut(playerid, A)
- {
- PlayerTextDrawBoxColor(playerid, Background[playerid], RGBToHex(0,0,0,A));
- PlayerTextDrawShow(playerid, Background[playerid]);
- if (A < 255) SetTimerEx("FadeOut", DELAY, false, "id", playerid, A+1);
- }
- forward FadeIn(playerid, A);
- public FadeIn(playerid, A)
- {
- PlayerTextDrawBoxColor(playerid, Background[playerid], RGBToHex(0,0,0,A));
- PlayerTextDrawShow(playerid, Background[playerid]);
- if (A) SetTimerEx("FadeIn", DELAY, false, "id", playerid, A-1); else PlayerTextDrawHide(playerid, Background[playerid]);
- }
Advertisement
Add Comment
Please, Sign In to add comment