Advertisement
FamiliaSAMP

FILTERSCRIPT - Sistema de Colorir chat [FAMILIASAMP.COM]

Feb 13th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. #include <a_samp>
  2. #define FILTERSCRIPT
  3. #define ColoredTextKey '*'
  4.  
  5. #define MESSAGE_COLOR 0xEEEEEEFF
  6. #define COLOR_AQUA 0x00FFFFFF
  7.  
  8. public OnFilterScriptInit()
  9. {
  10. print("K's Colored Chat FilterScript Successfully Loaded");
  11. return 1;
  12. }
  13.  
  14. public OnFilterScriptExit()
  15. {
  16. print("K's Colored Chat FilterScript Successfully Unloaded");
  17. return 1;
  18. }
  19.  
  20. enum ColorEnum
  21. {
  22. ColorName[16],
  23. ColorID[7]
  24. };
  25.  
  26. new String[200];
  27. new ColorsTag[][ColorEnum] =
  28. {
  29. {"Green", "00FF00"},
  30. {"Red", "FF0000"},
  31. {"White", "FFFFFF"},
  32. {"Blue", "0000FF"},
  33. {"Yellow", "FFFB00"},
  34. {"Orange", "FFA600"},
  35. {"Grey", "B8B8B8"},
  36. {"Purple", "7340DB"},
  37. {"Pink", "FF00EE"}
  38. };
  39.  
  40. stock ColouredText(text[])
  41. {
  42. new tString[16], I = -1;
  43. strmid(String, text, 0, 128, sizeof(String));
  44. for(new C = 0; C != sizeof(ColorsTag); C ++)
  45. {
  46. format(tString, sizeof(tString), "<%s>", ColorsTag[C][ColorName]);
  47. while((I = strfind(String, tString, true, (I + 1))) != -1)
  48. {
  49. new tLen = strlen(tString);
  50. format(tString, sizeof(tString), "{%s}", ColorsTag[C][ColorID]);
  51. if(tLen < 8) for(new C2 = 0; C2 != (8 - tLen); C2 ++) strins(String, " ", I);
  52. for(new tVar; ((String[I] != 0) && (tVar != 8)); I ++, tVar ++) String[I] = tString[tVar];
  53. if(tLen > 8) strdel(String, I, (I + (tLen - 8)));
  54. }
  55. }
  56. return String;
  57. }
  58.  
  59. stock GetName(playerid)
  60. {
  61. new Name[MAX_PLAYER_NAME];
  62. GetPlayerName(playerid, Name, sizeof(Name));
  63. return Name;
  64. }
  65.  
  66. public OnPlayerText(playerid, text[])
  67. {
  68. new ChatBubble[MAX_CHATBUBBLE_LENGTH+1]; //Chatbubble function credits goes to gl_chatbubble <3..
  69.  
  70. if(text[0] == ColoredTextKey)
  71. {
  72. new cText[128];
  73. format(cText, sizeof(cText), "*[VIP] %s(%d): %s", GetName(playerid), playerid, ColouredText(text[1]), playerid);
  74. format(ChatBubble,MAX_CHATBUBBLE_LENGTH,"%s", ColouredText(text[1]));
  75. SetPlayerChatBubble(playerid, ChatBubble, MESSAGE_COLOR,35.0,10000);
  76. SendClientMessageToAll(COLOR_AQUA, cText);
  77. return 0;
  78. }
  79. return 0;
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement