HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /* Forditotta SmaCk
  2.  
  3.  
  4. Csak Adminok by S34Qu4K3
  5.  
  6. ##CVARS##
  7.  
  8. "amx_onlyadmin_plays" "1" (Plugin ki/be kapcsolasa)
  9. "amx_onlyadmin_plays_restrictmode" "1" (Mod korlátozas: Oles; 2: Spectator; 3: Fuggetlen; 4: Rugas; Alap = 1)
  10.  
  11.  
  12. */
  13.  
  14. #include <amxmodx>
  15. #include <amxmisc>
  16. #include <cstrike>
  17. #include <hamsandwich>
  18.  
  19. #define PLUGIN "Only Admin Plays"
  20. #define VERSION "2.0"
  21. #define AUTHOR "S34Qu4K3"
  22.  
  23. new const Reason[] = "Adminnak kell lenned a játékhoz."
  24.  
  25. new toggle
  26.  
  27. new restrictmode
  28.  
  29. public plugin_init() {
  30. register_plugin(PLUGIN, VERSION, AUTHOR)
  31.  
  32. toggle = register_cvar( "amx_onlyadmin_plays", "1" );
  33. restrictmode = register_cvar( "amx_onlyadmin_plays_restrictmode", "1");
  34.  
  35. RegisterHam(Ham_Spawn, "player", "Main", 1);
  36.  
  37. register_dictionary( "onlyadminplays.txt" );
  38.  
  39.  
  40. }
  41. public Main(id)
  42. {
  43. if(get_pcvar_num(toggle))
  44. {
  45.  
  46. if(get_user_flags(id) & ADMIN_KICK && is_user_alive(id) )
  47. {
  48. if(cs_get_user_team(id) != CS_TEAM_UNASSIGNED)
  49.  
  50. client_print( id, print_chat, "[AMXX] %L", LANG_PLAYER, "CANPLAY" )
  51. }
  52. else if( is_user_alive(id) )
  53. {
  54. switch( get_pcvar_num( restrictmode ) )
  55. {
  56. case 1:
  57. {
  58. if(cs_get_user_team(id) != CS_TEAM_SPECTATOR && cs_get_user_team(id) != CS_TEAM_UNASSIGNED)
  59. {
  60. user_kill(id)
  61. client_print( id, print_chat, "[AMXX] %L", LANG_PLAYER, "CANTPLAY" )
  62. }
  63. }
  64. case 2:
  65. {
  66. if(cs_get_user_team(id) != CS_TEAM_SPECTATOR)
  67. {
  68. cs_set_user_team(id, CS_TEAM_SPECTATOR)
  69. client_print( id, print_chat, "[AMXX] %L", LANG_PLAYER, "CANTPLAY" )
  70. }
  71. }
  72. case 3:
  73. {
  74. if(cs_get_user_team(id) != CS_TEAM_UNASSIGNED)
  75. {
  76. cs_set_user_team(id, CS_TEAM_UNASSIGNED)
  77. client_print( id, print_chat, "[AMXX] %L", LANG_PLAYER, "CANTPLAY" )
  78. }
  79. }
  80. case 4:
  81. {
  82.  
  83. emessage_begin(MSG_ONE, SVC_DISCONNECT, _, id);
  84. ewrite_string( Reason );
  85. emessage_end();
  86.  
  87. }
  88.  
  89. }
  90.  
  91.  
  92. }
  93. }
  94. }
  95.