SHARE
TWEET

Message.inc

Jakwob-WG Jun 16th, 2015 (edited) 34 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #if defined _Message_included
  2.         #endinput
  3. #endif
  4. #define _Message_included
  5.  
  6. // Player Text
  7. new PlayerText:UsageTD[MAX_PLAYERS];
  8. new PlayerText:ErrorTD[MAX_PLAYERS];
  9. new PlayerText:MessageTD[MAX_PLAYERS];
  10. // Timers
  11. new ErrorTimer[MAX_PLAYERS];
  12. new UsageTimer[MAX_PLAYERS];
  13. new MessageTimer[MAX_PLAYERS];
  14. // Native Functions
  15. //native SendErrorMessage(playerid, const message[]);
  16. //native SendUsageMessage(playerid, const message[]);
  17. //native SendInfoMessage(playerid, const message[]);
  18. //native CreateTDs(playerid);
  19. //native DestroyTDs(playerid);
  20.  
  21. forward RemoveErrorMessage(playerid);
  22. forward RemoveUsageMessage(playerid);
  23. forward RemoveMessage(playerid);
  24.  
  25. SendErrorMessage(playerid, const message[])
  26. {
  27.         new msg[138];
  28.         format(msg, sizeof msg, "Error: ~w~%s", message);
  29.     PlayerTextDrawSetString(playerid, ErrorTD[playerid], msg);
  30.         PlayerTextDrawShow(playerid, ErrorTD[playerid]);
  31.         ErrorTimer[playerid] = SetTimerEx("RemoveErrorMessage", 5000, false, "i", playerid);
  32.         return 1;
  33. }
  34.  
  35. SendUsageMessage(playerid, const message[])
  36. {
  37.         new msg[138];
  38.         format(msg, sizeof msg, "Usage: ~w~%s", message);
  39.     PlayerTextDrawSetString(playerid, UsageTD[playerid], msg);
  40.         PlayerTextDrawShow(playerid, UsageTD[playerid]);
  41.         UsageTimer[playerid] = SetTimerEx("RemoveUsageMessage", 5000, false, "i", playerid);
  42.         return 1;
  43. }
  44.  
  45. SendInfoMessage(playerid, const message[])
  46. {
  47.         new msg[138];
  48.         format(msg, sizeof msg, "Msg: ~w~%s", message);
  49.     PlayerTextDrawSetString(playerid, MessageTD[playerid], msg);
  50.         PlayerTextDrawShow(playerid, MessageTD[playerid]);
  51.         MessageTimer[playerid] = SetTimerEx("RemoveMessage", 5000, false, "i", playerid);
  52.         return 1;
  53. }
  54.  
  55. public RemoveErrorMessage(playerid)
  56. {
  57.     PlayerTextDrawHide(playerid, ErrorTD[playerid]);
  58.     printf("Error message hidden for playerid %d", playerid);
  59.         return 1;
  60. }
  61.  
  62. public RemoveUsageMessage(playerid)
  63. {
  64.     PlayerTextDrawHide(playerid, UsageTD[playerid]);
  65.     printf("Useage message hidden for playerid %d", playerid);
  66.         return 1;
  67. }
  68.  
  69. public RemoveMessage(playerid)
  70. {
  71.     PlayerTextDrawHide(playerid, MessageTD[playerid]);
  72.     printf("Message hidden for playerid %d", playerid);
  73.         return 1;
  74. }
  75.  
  76.  
  77. CreateMessageTDs(playerid)
  78. {
  79.         UsageTD[playerid] = CreatePlayerTextDraw(playerid,130.000000, 350.000000, "Usage: ~w~%s");
  80.         PlayerTextDrawBackgroundColor(playerid,UsageTD[playerid], 255);
  81.         PlayerTextDrawFont(playerid,UsageTD[playerid], 1);
  82.         PlayerTextDrawLetterSize(playerid,UsageTD[playerid], 0.300000, 1.000000);
  83.         PlayerTextDrawColor(playerid,UsageTD[playerid], -65366);
  84.         PlayerTextDrawSetOutline(playerid,UsageTD[playerid], 0);
  85.         PlayerTextDrawSetProportional(playerid,UsageTD[playerid], 1);
  86.         PlayerTextDrawSetShadow(playerid,UsageTD[playerid], 1);
  87.         PlayerTextDrawSetSelectable(playerid,UsageTD[playerid], 0);
  88.  
  89.         ErrorTD[playerid] = CreatePlayerTextDraw(playerid,135.000000, 360.000000, "Error: ~w~%s");
  90.         PlayerTextDrawBackgroundColor(playerid,ErrorTD[playerid], 255);
  91.         PlayerTextDrawFont(playerid,ErrorTD[playerid], 1);
  92.         PlayerTextDrawLetterSize(playerid,ErrorTD[playerid], 0.300000, 1.000000);
  93.         PlayerTextDrawColor(playerid,ErrorTD[playerid], 0xFF0000FF);
  94.         PlayerTextDrawSetOutline(playerid,ErrorTD[playerid], 0);
  95.         PlayerTextDrawSetProportional(playerid,ErrorTD[playerid], 1);
  96.         PlayerTextDrawSetShadow(playerid,ErrorTD[playerid], 1);
  97.         PlayerTextDrawSetSelectable(playerid,ErrorTD[playerid], 0);
  98.  
  99.         MessageTD[playerid] = CreatePlayerTextDraw(playerid,139.000000, 370.000000, "Msg: ~w~%s");
  100.         PlayerTextDrawBackgroundColor(playerid,MessageTD[playerid], 255);
  101.         PlayerTextDrawFont(playerid,MessageTD[playerid], 1);
  102.         PlayerTextDrawLetterSize(playerid,MessageTD[playerid], 0.300000, 1.000000);
  103.         PlayerTextDrawColor(playerid,MessageTD[playerid], -16711681);
  104.         PlayerTextDrawSetOutline(playerid,MessageTD[playerid], 0);
  105.         PlayerTextDrawSetProportional(playerid,MessageTD[playerid], 1);
  106.         PlayerTextDrawSetShadow(playerid,MessageTD[playerid], 1);
  107.         PlayerTextDrawSetSelectable(playerid,MessageTD[playerid], 0);
  108.        
  109.         printf("** Message Textdraws Created for playerid %d **", playerid);
  110. }
  111.  
  112. DestroyMessageTDs(playerid)
  113. {
  114.         PlayerTextDrawDestroy(playerid, UsageTD[playerid]);
  115.         PlayerTextDrawDestroy(playerid, ErrorTD[playerid]);
  116.         PlayerTextDrawDestroy(playerid, MessageTD[playerid]);
  117. }
RAW Paste Data
Top