Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ### LIST OF STYLES ###
- ###############################################################################
- GTXT_PRICEDOWN_THIN
- DESCRIPTION The 'Pricedown' font with a thin border.
- POSITION Mid-screen.
- ###############################################################################
- GTXT_PRICEDOWN_THICK
- DESCRIPTION The 'Pricedown' font with a THICK border.
- POSITION Mid-screen.
- ###############################################################################
- GTXT_CAPITALS_THIN
- DESCRIPTION The 'CAPITALS' font with a thin border.
- POSITION Mid-screen.
- ###############################################################################
- GTXT_CAPITALS_THICK
- DESCRIPTION The 'CAPITALS' font with a THICK border.
- POSITION Mid-screen.
- ###############################################################################
- */
- #include <YSI\y_hooks>
- #define GTXT_PRICEDOWN_THIN 0
- #define GTXT_PRICEDOWN_THICK 1
- #define GTXT_CAPITALS_THIN 2
- #define GTXT_CAPITALS_THICK 3
- /*
- native TD_GameTextForPlayer(playerid, text[], style=GTXT_CAPITALS_THICK, duration=5000);
- */
- new PlayerText:TD_GTXT_TDID[MAX_PLAYERS]; // Textdraw IDs
- new TD_GTXT_TIMER[MAX_PLAYERS];
- stock TD_GameTextForPlayer(playerid, text[], style=GTXT_CAPITALS_THICK, duration=5000)
- {
- if(TD_GTXT_TDID[playerid] == PlayerText:INVALID_TEXT_DRAW) // Not created
- {
- switch(style)
- {
- case GTXT_PRICEDOWN_THIN:
- {
- TD_GTXT_TDID[playerid] = CreatePlayerTextDraw(playerid, 320.000000, 200.000000, text);
- PlayerTextDrawAlignment(playerid, TD_GTXT_TDID[playerid], 2);
- PlayerTextDrawBackgroundColor(playerid, TD_GTXT_TDID[playerid], 255);
- PlayerTextDrawFont(playerid, TD_GTXT_TDID[playerid], 3);
- PlayerTextDrawLetterSize(playerid, TD_GTXT_TDID[playerid], 0.800000, 2.800000);
- PlayerTextDrawColor(playerid, TD_GTXT_TDID[playerid], -1);
- PlayerTextDrawTextSize(playerid, TD_GTXT_TDID[playerid], 0, 550);
- PlayerTextDrawSetOutline(playerid, TD_GTXT_TDID[playerid], 1);
- }
- case GTXT_PRICEDOWN_THICK:
- {
- TD_GTXT_TDID[playerid] = CreatePlayerTextDraw(playerid, 320.000000, 200.000000, text);
- PlayerTextDrawAlignment(playerid, TD_GTXT_TDID[playerid], 2);
- PlayerTextDrawBackgroundColor(playerid, TD_GTXT_TDID[playerid], 255);
- PlayerTextDrawFont(playerid, TD_GTXT_TDID[playerid], 3);
- PlayerTextDrawLetterSize(playerid, TD_GTXT_TDID[playerid], 0.800000, 2.800000);
- PlayerTextDrawColor(playerid, TD_GTXT_TDID[playerid], -1);
- PlayerTextDrawTextSize(playerid, TD_GTXT_TDID[playerid], 0, 550);
- PlayerTextDrawSetOutline(playerid, TD_GTXT_TDID[playerid], 2);
- }
- case GTXT_CAPITALS_THIN:
- {
- TD_GTXT_TDID[playerid] = CreatePlayerTextDraw(playerid, 320.000000, 222.000000, text);
- PlayerTextDrawAlignment(playerid, TD_GTXT_TDID[playerid], 2);
- PlayerTextDrawBackgroundColor(playerid, TD_GTXT_TDID[playerid], 255);
- PlayerTextDrawFont(playerid, TD_GTXT_TDID[playerid], 2);
- PlayerTextDrawLetterSize(playerid, TD_GTXT_TDID[playerid], 0.619998, 2.700000);
- PlayerTextDrawColor(playerid, TD_GTXT_TDID[playerid], -1872621313);
- PlayerTextDrawSetOutline(playerid, TD_GTXT_TDID[playerid], 1);
- }
- case GTXT_CAPITALS_THICK:
- {
- TD_GTXT_TDID[playerid] = CreatePlayerTextDraw(playerid, 320.000000, 222.000000, text);
- PlayerTextDrawAlignment(playerid, TD_GTXT_TDID[playerid], 2);
- PlayerTextDrawBackgroundColor(playerid, TD_GTXT_TDID[playerid], 255);
- PlayerTextDrawFont(playerid, TD_GTXT_TDID[playerid], 2);
- PlayerTextDrawLetterSize(playerid, TD_GTXT_TDID[playerid], 0.619998, 2.700000);
- PlayerTextDrawColor(playerid, TD_GTXT_TDID[playerid], -1872621313);
- PlayerTextDrawSetOutline(playerid, TD_GTXT_TDID[playerid], 2);
- }
- }
- }
- else // Created, set string and kill duration timer
- {
- KillTimer(TD_GTXT_TIMER[playerid]);
- PlayerTextDrawSetString(playerid, TD_GTXT_TDID[playerid], text);
- }
- PlayerTextDrawShow(playerid, TD_GTXT_TDID[playerid]);
- // Duration
- if(duration > 0) // Stay until hidden by script
- {
- TD_GTXT_TIMER[playerid] = SetTimerEx("TD_GTXT_HIDE", duration, false, "i", playerid);
- }
- return 1;
- }
- hook OnPlayerConnect(playerid)
- {
- TD_GTXT_TIMER[playerid] = -1;
- TD_GTXT_TDID[playerid] = PlayerText:INVALID_TEXT_DRAW;
- return 1;
- }
- hook OnPlayerDisconnect(playerid, reason)
- {
- KillTimer(TD_GTXT_TIMER[playerid]);
- return 1;
- }
- forward TD_GTXT_HIDE(playerid);
- public TD_GTXT_HIDE(playerid)
- {
- PlayerTextDrawDestroy(playerid, TD_GTXT_TDID[playerid]);
- TD_GTXT_TDID[playerid] = PlayerText:INVALID_TEXT_DRAW;
- TD_GTXT_TIMER[playerid] = -1;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment