Guest User

Untitled

a guest
Mar 30th, 2013
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.57 KB | None | 0 0
  1. /*
  2.  
  3. ### LIST OF STYLES ###
  4.  
  5. ###############################################################################
  6.      GTXT_PRICEDOWN_THIN
  7.  
  8. DESCRIPTION         The 'Pricedown' font with a thin border.
  9. POSITION            Mid-screen.
  10. ###############################################################################
  11.      GTXT_PRICEDOWN_THICK
  12.  
  13. DESCRIPTION         The 'Pricedown' font with a THICK border.
  14. POSITION            Mid-screen.
  15. ###############################################################################
  16.      GTXT_CAPITALS_THIN
  17.  
  18. DESCRIPTION         The 'CAPITALS' font with a thin border.
  19. POSITION            Mid-screen.
  20. ###############################################################################
  21.      GTXT_CAPITALS_THICK
  22.  
  23. DESCRIPTION         The 'CAPITALS' font with a THICK border.
  24. POSITION            Mid-screen.
  25. ###############################################################################
  26.    
  27. */
  28.  
  29. #include <YSI\y_hooks>
  30.  
  31. #define GTXT_PRICEDOWN_THIN 0
  32. #define GTXT_PRICEDOWN_THICK 1
  33. #define GTXT_CAPITALS_THIN 2
  34. #define GTXT_CAPITALS_THICK 3
  35.  
  36. /*
  37. native TD_GameTextForPlayer(playerid, text[], style=GTXT_CAPITALS_THICK, duration=5000);
  38. */
  39.  
  40. new PlayerText:TD_GTXT_TDID[MAX_PLAYERS]; // Textdraw IDs
  41. new TD_GTXT_TIMER[MAX_PLAYERS];
  42.  
  43. stock TD_GameTextForPlayer(playerid, text[], style=GTXT_CAPITALS_THICK, duration=5000)
  44. {
  45.     if(TD_GTXT_TDID[playerid] == PlayerText:INVALID_TEXT_DRAW) // Not created
  46.     {
  47.         switch(style)
  48.         {
  49.             case GTXT_PRICEDOWN_THIN:
  50.             {
  51.                 TD_GTXT_TDID[playerid] = CreatePlayerTextDraw(playerid, 320.000000, 200.000000, text);
  52.                 PlayerTextDrawAlignment(playerid, TD_GTXT_TDID[playerid], 2);
  53.                 PlayerTextDrawBackgroundColor(playerid, TD_GTXT_TDID[playerid], 255);
  54.                 PlayerTextDrawFont(playerid, TD_GTXT_TDID[playerid], 3);
  55.                 PlayerTextDrawLetterSize(playerid, TD_GTXT_TDID[playerid], 0.800000, 2.800000);
  56.                 PlayerTextDrawColor(playerid, TD_GTXT_TDID[playerid], -1);
  57.                 PlayerTextDrawTextSize(playerid, TD_GTXT_TDID[playerid], 0, 550);
  58.                 PlayerTextDrawSetOutline(playerid, TD_GTXT_TDID[playerid], 1);
  59.             }
  60.             case GTXT_PRICEDOWN_THICK:
  61.             {
  62.                 TD_GTXT_TDID[playerid] = CreatePlayerTextDraw(playerid, 320.000000, 200.000000, text);
  63.                 PlayerTextDrawAlignment(playerid, TD_GTXT_TDID[playerid], 2);
  64.                 PlayerTextDrawBackgroundColor(playerid, TD_GTXT_TDID[playerid], 255);
  65.                 PlayerTextDrawFont(playerid, TD_GTXT_TDID[playerid], 3);
  66.                 PlayerTextDrawLetterSize(playerid, TD_GTXT_TDID[playerid], 0.800000, 2.800000);
  67.                 PlayerTextDrawColor(playerid, TD_GTXT_TDID[playerid], -1);
  68.                 PlayerTextDrawTextSize(playerid, TD_GTXT_TDID[playerid], 0, 550);
  69.                 PlayerTextDrawSetOutline(playerid, TD_GTXT_TDID[playerid], 2);
  70.             }
  71.             case GTXT_CAPITALS_THIN:
  72.             {
  73.                 TD_GTXT_TDID[playerid] = CreatePlayerTextDraw(playerid, 320.000000, 222.000000, text);
  74.                 PlayerTextDrawAlignment(playerid, TD_GTXT_TDID[playerid], 2);
  75.                 PlayerTextDrawBackgroundColor(playerid, TD_GTXT_TDID[playerid], 255);
  76.                 PlayerTextDrawFont(playerid, TD_GTXT_TDID[playerid], 2);
  77.                 PlayerTextDrawLetterSize(playerid, TD_GTXT_TDID[playerid], 0.619998, 2.700000);
  78.                 PlayerTextDrawColor(playerid, TD_GTXT_TDID[playerid], -1872621313);
  79.                 PlayerTextDrawSetOutline(playerid, TD_GTXT_TDID[playerid], 1);
  80.             }
  81.             case GTXT_CAPITALS_THICK:
  82.             {
  83.                 TD_GTXT_TDID[playerid] = CreatePlayerTextDraw(playerid, 320.000000, 222.000000, text);
  84.                 PlayerTextDrawAlignment(playerid, TD_GTXT_TDID[playerid], 2);
  85.                 PlayerTextDrawBackgroundColor(playerid, TD_GTXT_TDID[playerid], 255);
  86.                 PlayerTextDrawFont(playerid, TD_GTXT_TDID[playerid], 2);
  87.                 PlayerTextDrawLetterSize(playerid, TD_GTXT_TDID[playerid], 0.619998, 2.700000);
  88.                 PlayerTextDrawColor(playerid, TD_GTXT_TDID[playerid], -1872621313);
  89.                 PlayerTextDrawSetOutline(playerid, TD_GTXT_TDID[playerid], 2);
  90.             }
  91.         }
  92.     }
  93.     else // Created, set string and kill duration timer
  94.     {
  95.         KillTimer(TD_GTXT_TIMER[playerid]);
  96.         PlayerTextDrawSetString(playerid, TD_GTXT_TDID[playerid], text);
  97.     }
  98.     PlayerTextDrawShow(playerid, TD_GTXT_TDID[playerid]);
  99.    
  100.     // Duration
  101.     if(duration > 0) // Stay until hidden by script
  102.     {
  103.         TD_GTXT_TIMER[playerid] = SetTimerEx("TD_GTXT_HIDE", duration, false, "i", playerid);
  104.     }
  105.     return 1;
  106. }
  107.  
  108. hook OnPlayerConnect(playerid)
  109. {
  110.     TD_GTXT_TIMER[playerid] = -1;
  111.     TD_GTXT_TDID[playerid] = PlayerText:INVALID_TEXT_DRAW;
  112.     return 1;
  113. }
  114.  
  115. hook OnPlayerDisconnect(playerid, reason)
  116. {
  117.     KillTimer(TD_GTXT_TIMER[playerid]);
  118.     return 1;
  119. }
  120.  
  121. forward TD_GTXT_HIDE(playerid);
  122. public TD_GTXT_HIDE(playerid)
  123. {
  124.     PlayerTextDrawDestroy(playerid, TD_GTXT_TDID[playerid]);
  125.     TD_GTXT_TDID[playerid] = PlayerText:INVALID_TEXT_DRAW;
  126.     TD_GTXT_TIMER[playerid] = -1;
  127.     return 1;
  128. }
Advertisement
Add Comment
Please, Sign In to add comment