Advertisement
Guest User

Untitled

a guest
Jan 18th, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <clientprefs>
  3. #include <cstrike>
  4. #pragma newdecls required
  5.  
  6. #define PREFIX "\x01\x0B \x07[TAGS]\x04"
  7.  
  8. Handle tag_cookie;
  9. char players_tag[MAXPLAYERS +1][13];
  10.  
  11. public Plugin myinfo =
  12. {
  13. name = "Custom tags for VIP's",
  14. author = "Super Timor",
  15. version = "1.0.0",
  16. description = "",
  17. url = "https://cs-placzabaw.pl"
  18. };
  19. public void OnPluginStart()
  20. {
  21. HookEvent("player_spawn", OdrodzenieGracza);
  22. tag_cookie = RegClientCookie("tag_name", "Player's custom tag", CookieAccess_Private);
  23. RegConsoleCmd("sm_tag", SetTag);
  24. }
  25. public void OnClientCookiesCached(int client)
  26. {
  27. if(!IsValidClient(client) || IsFakeClient(client))
  28. return;
  29.  
  30. char sCookie[1024];
  31. GetClientCookie(client, tag_cookie, sCookie, sizeof(sCookie));
  32. if(!StrEqual(sCookie, ""))
  33. {
  34. strcopy(players_tag[client], sizeof(players_tag[]), sCookie);
  35. CS_SetClientClanTag(client, players_tag[client]);
  36. }
  37. }
  38. public Action SetTag(int client, int args)
  39. {
  40. if(GetUserFlagBits(client) & ADMFLAG_RESERVATION)
  41. {
  42. if (args < 1)
  43. {
  44. ReplyToCommand(client, "%s Użycie: sm_tag [tag]", PREFIX);
  45. return Plugin_Handled;
  46. }
  47.  
  48. char arg[13];
  49. if (args == 1)
  50. {
  51. char arg2[15];
  52. GetCmdArg(1, arg2, sizeof(arg2));
  53. int taglen = strlen(arg2);
  54.  
  55. if (taglen > 12)
  56. PrintToChat(client, "%s Tag musi zawierać mniej, niż 13 znaków!", PREFIX);
  57. else
  58. {
  59. GetCmdArg(1, arg, sizeof(arg));
  60. SetClientCookie(client, tag_cookie, arg);
  61. CS_SetClientClanTag(client, arg);
  62. PrintToChat(client, "%s Zmieniono tag na : %s", PREFIX, arg);
  63. }
  64. }
  65. return Plugin_Continue;
  66. }
  67. else
  68. {
  69. PrintToChat(client, "%s Ta funkcja jest dostępna tylko dla VIP!", PREFIX);
  70. }
  71. return Plugin_Continue;
  72. }
  73. public void OdrodzenieGracza(Event event, const char[] name, bool dontBroadcast)
  74. {
  75. int client = GetClientOfUserId(GetEventInt(event, "userid"));
  76.  
  77. if(!IsValidClient(client))
  78. return;
  79.  
  80. CS_SetClientClanTag(client, players_tag[client]);
  81. }
  82. stock bool IsValidClient(int client)
  83. {
  84. if (client > 0 && client <= MAXPLAYERS && IsClientInGame(client))
  85. return true;
  86. return false;
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement