Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. #pragma semicolon 1
  2. #pragma newdecls required
  3.  
  4. #include <sourcemod>
  5. #include <sdktools>
  6. #include <cstrike>
  7.  
  8. public void OnPluginStart()
  9. {
  10. LoadTranslations("common.phrases");
  11.  
  12. RegAdminCmd("sm_spec", Command_Spectator, ADMFLAG_GENERIC, "sm_spec <#userid|name>");
  13. RegAdminCmd("sm_t", Command_Terrorist, ADMFLAG_GENERIC, "sm_t <#userid|name>");
  14. RegAdminCmd("sm_ct", Command_CounterTerrorist, ADMFLAG_GENERIC, "sm_ct <#userid|name>");
  15. }
  16.  
  17. public Action Command_Spectator(int client, int args)
  18. {
  19. if (args < 1)
  20. {
  21. ReplyToCommand(client, "{SM] Usage: sm_spectator <#userid|name>");
  22. return Plugin_Handled;
  23. }
  24.  
  25. char arg[256];
  26. GetCmdArgString(arg, sizeof(arg));
  27.  
  28. int target = FindTarget(client, arg, false, true);
  29. if (target == -1)
  30. {
  31. return Plugin_Handled;
  32. }
  33.  
  34. if (GetClientTeam(target) == CS_TEAM_SPECTATOR)
  35. {
  36. ReplyToCommand(client, "{SM] This command cannot be used on spectators.");
  37. return Plugin_Handled;
  38. }
  39.  
  40. if (IsPlayerAlive(target))
  41. {
  42. ForcePlayerSuicide(target);
  43. }
  44.  
  45. ChangeClientTeam(target, CS_TEAM_SPECTATOR);
  46. PrintToChatAll("[SM] ADMIN: Moved %N to Spectators", target);
  47.  
  48. return Plugin_Handled;
  49. }
  50.  
  51. public Action Command_Terrorist(int client, int args)
  52. {
  53. if (args < 1)
  54. {
  55. ReplyToCommand(client, "{SM] Usage: sm_t <#userid|name>");
  56. return Plugin_Handled;
  57. }
  58.  
  59. char arg[256];
  60. GetCmdArgString(arg, sizeof(arg));
  61.  
  62. int target = FindTarget(client, arg);
  63. if (target == -1)
  64. {
  65. return Plugin_Handled;
  66. }
  67.  
  68. if (GetClientTeam(target) == CS_TEAM_T)
  69. {
  70. ReplyToCommand(client, "{SM] This command cannot be used on terrorists.");
  71. return Plugin_Handled;
  72. }
  73.  
  74. if (IsPlayerAlive(target))
  75. {
  76. ForcePlayerSuicide(target);
  77. }
  78.  
  79. ChangeClientTeam(target, CS_TEAM_T);
  80. PrintToChatAll("[SM] ADMIN: Moved %N to Terrorists", target);
  81.  
  82. return Plugin_Handled;
  83. }
  84.  
  85. public Action Command_CounterTerrorist(int client, int args)
  86. {
  87. if (args < 1)
  88. {
  89. ReplyToCommand(client, "{SM] Usage: sm_ct <#userid|name>");
  90. return Plugin_Handled;
  91. }
  92.  
  93. char arg[256];
  94. GetCmdArgString(arg, sizeof(arg));
  95.  
  96. int target = FindTarget(client, arg);
  97. if (target == -1)
  98. {
  99. return Plugin_Handled;
  100. }
  101.  
  102. if (GetClientTeam(target) == CS_TEAM_CT)
  103. {
  104. ReplyToCommand(client, "{SM] This command cannot be used on CT.");
  105. return Plugin_Handled;
  106. }
  107.  
  108. if (IsPlayerAlive(target))
  109. {
  110. ForcePlayerSuicide(target);
  111. }
  112.  
  113. ChangeClientTeam(target, CS_TEAM_CT);
  114. PrintToChatAll("[SM] ADMIN: Moved %N to CT", target);
  115.  
  116. return Plugin_Handled;
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement