Advertisement
Guest User

HudWrite.sp

a guest
Jun 22nd, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. #pragma semicolon 1
  2. #pragma newdecls required
  3.  
  4. #define PLUGIN_AUTHOR "Mithat Guner"
  5. #define PLUGIN_VERSION "1.2"
  6.  
  7. #include <sourcemod>
  8. #include <sdktools>
  9.  
  10. ConVar hud_red;
  11. ConVar hud_green;
  12. ConVar hud_blue;
  13. ConVar hud_xpos;
  14. ConVar hud_ypos;
  15.  
  16. public Plugin myinfo =
  17. {
  18. name = "HUD Write",
  19. author = PLUGIN_AUTHOR,
  20. description = "HUD Write",
  21. version = PLUGIN_VERSION,
  22. url = "pluginler.com"
  23. };
  24.  
  25. public void OnPluginStart()
  26. {
  27. hud_red = CreateConVar("mithat_hud_red", "255", "RGB RED Color");
  28. hud_green = CreateConVar("mithat_hud_blue", "0", "RGB BLUE Color");
  29. hud_blue = CreateConVar("mithat_hud_green", "0", "RGB GREEN Color");
  30. hud_xpos = CreateConVar("mithat_hud_x", "0.01", "HUD X POS");
  31. hud_ypos = CreateConVar("mithat_hud_y", "0.48", "HUD Y POS");
  32. AutoExecConfig(true, "hudwrite");
  33. RegAdminCmd("sm_hwrite", write, ADMFLAG_GENERIC, "HUD Write - Mithat Guner");
  34.  
  35. }
  36. public Action write(int client, int args)
  37. {
  38. if (args < 1)
  39. {
  40. ReplyToCommand(client, "Használat: sm_hwrite <üzenet>");
  41. return Plugin_Handled;
  42. }
  43.  
  44. char text[192];
  45. GetCmdArgString(text, sizeof(text));
  46.  
  47. for(int i = 1; i <= MaxClients; i++)
  48. {
  49. if(IsClientInGame(i) && !IsFakeClient(i))
  50. {
  51. SetHudTextParams(GetConVarFloat(hud_xpos), GetConVarFloat(hud_ypos), 3.0, GetConVarInt(hud_red), GetConVarInt(hud_blue), GetConVarInt(hud_green), 255, 0, 0.25, 0.5, 0.3);
  52.  
  53. if (StrContains(text[0], "@r", false) == 0)
  54. {
  55. ReplaceString(text, sizeof(text), "@r", "");
  56. SetHudTextParams(GetConVarFloat(hud_xpos), GetConVarFloat(hud_ypos), 3.0, 255, 0, 0, 255, 0, 0.25, 0.5, 0.3);
  57. ShowHudText(i, 1, text);
  58. }
  59.  
  60. if (StrContains(text[0], "@g", false) == 0)
  61. {
  62. ReplaceString(text, sizeof(text), "@g", "");
  63. SetHudTextParams(GetConVarFloat(hud_xpos), GetConVarFloat(hud_ypos), 3.0, 0, 255, 0, 255, 0, 0.25, 0.5, 0.3);
  64. ShowHudText(i, 1, text);
  65. }
  66.  
  67. if (StrContains(text[0], "@b", false) == 0)
  68. {
  69. ReplaceString(text, sizeof(text), "@b", "");
  70. SetHudTextParams(GetConVarFloat(hud_xpos), GetConVarFloat(hud_ypos), 3.0, 0, 0, 255, 255, 0, 0.25, 0.5, 0.3);
  71. ShowHudText(i, 1, text);
  72. }
  73.  
  74. if (StrContains(text[0], "@w", false) == 0)
  75. {
  76. ReplaceString(text, sizeof(text), "@w", "");
  77. SetHudTextParams(GetConVarFloat(hud_xpos), GetConVarFloat(hud_ypos), 3.0, 255, 255, 255, 255, 0, 0.25, 0.5, 0.3);
  78. ShowHudText(i, 1, text);
  79. }
  80.  
  81. if (StrContains(text[0], "@y", false) == 0)
  82. {
  83. ReplaceString(text, sizeof(text), "@y", "");
  84. SetHudTextParams(GetConVarFloat(hud_xpos), GetConVarFloat(hud_ypos), 3.0, 255, 255, 51, 255, 0, 0.25, 0.5, 0.3);
  85. ShowHudText(i, 1, text);
  86. }
  87.  
  88. if (StrContains(text[0], "@h", false) == 0)
  89. {
  90. ReplaceString(text, sizeof(text), "@h", "");
  91. SetHudTextParams(GetConVarFloat(hud_xpos), GetConVarFloat(hud_ypos), 3.0, 0, 0, 0, 255, 0, 0.25, 0.5, 0.3);
  92. ShowHudText(i, 1, text);
  93. }
  94.  
  95. ShowHudText(i, 1, text);
  96. }
  97. }
  98. return Plugin_Handled;
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement