Advertisement
Guest User

Untitled

a guest
Oct 13th, 2013
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. #pragma semicolon 1
  2.  
  3. #include <sourcemod>
  4. #include <sdktools>
  5.  
  6. #define PLUGIN_VERSION "1.0.0"
  7.  
  8.  
  9. new Handle:cvarTags, Handle:crits, Handle:nodmgspread;
  10.  
  11.  
  12. public Plugin:myinfo = {
  13. name = "Hide Tags",
  14. author = "Messy Recipe",
  15. description = "Hide server tags for nocrits and nodmgspread",
  16. version = PLUGIN_VERSION,
  17. url = "http://www.ctpirates.net/"
  18. }
  19.  
  20. public OnPluginStart() {
  21. LoadTranslations("common.phrases");
  22. CreateConVar("sm_hidetags_version", PLUGIN_VERSION, "Hide Tags Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
  23.  
  24. cvarTags = FindConVar("sv_tags");
  25. crits = FindConVar("tf_weapon_criticals");
  26. nodmgspread = FindConVar("tf_damage_disablespread");
  27.  
  28. new flags = GetConVarFlags(cvarTags);
  29. flags &= ~FCVAR_NOTIFY;
  30. SetConVarFlags(cvarTags, flags);
  31. }
  32.  
  33. public OnGameFrame() {
  34. if (GetConVarInt(crits) == 0) {
  35. SetConVarString(cvarTags, TagsCheck("nocrits", true));
  36. }
  37. if (GetConVarInt(nodmgspread) == 1) {
  38. SetConVarString(cvarTags, TagsCheck("nodmgspread", true));
  39. }
  40. }
  41.  
  42. stock String:TagsCheck(const String:tag[], bool:remove = false) {
  43. decl String:tags[255];
  44. GetConVarString(cvarTags, tags, sizeof(tags));
  45.  
  46. if (StrContains(tags, tag, false) == -1 && !remove) {
  47. decl String:newTags[255];
  48. Format(newTags, sizeof(newTags), "%s,%s", tags, tag);
  49. ReplaceString(newTags, sizeof(newTags), ",,", ",", false);
  50. tags = newTags;
  51. } else if (StrContains(tags, tag, false) > -1 && remove) {
  52. ReplaceString(tags, sizeof(tags), tag, "", false);
  53. ReplaceString(tags, sizeof(tags), ",,", ",", false);
  54. }
  55.  
  56. return tags;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement