HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*
  2. SIMPLE SLOTS RESERVATION v0.0.7
  3.  
  4. Simple Slots Reservation is a plugin that allow you to reservate slots at your server.
  5. But unlike AMXX's reservation slots plugin, this version does NOT reservate the slots all the time.
  6. With AMXX's version if you have 1 reservated slot, it will reservate the slot all the time, wich means:
  7. - The server might have admins connected, but it still reservating the slot.
  8. With this version if you have 1 reservated slot, it will only reservate the slot if there are not any admin connected, wich means:
  9. - Non-admins will be able to join the server if there is already 1 admin connected.
  10.  
  11. To be more simple, if the amount of admins connected is equal or higher than your reservated slots amount, normal players will be able to join the last slots.
  12. Advantage:
  13. - Your players will be happy for don't get kicked when there are already enough admins connected at the server.
  14.  
  15. Cvar: ssr_amount "#"
  16. # = Amount of slots you want to reservate
  17.  
  18. Credits:
  19. - AMXX Develop Team - Base Code & ML File
  20. - pokemonmaster - Kick Stock
  21. - Backstabnoob - Scripting Suggestions
  22. - The AMXX's Bible aka Arkshine - Scripting Suggestions
  23. */
  24.  
  25. #include <amxmodx>
  26. #include <amxmisc>
  27.  
  28. enum _:PluginInfo {
  29. PluginName,
  30. PluginVersion
  31. }
  32.  
  33. new const Get_Info[PluginInfo][] =
  34. {
  35. "Simple Slots Reservation",
  36. "0.0.7"
  37. }
  38.  
  39. new slots, maxplayers
  40.  
  41. public plugin_init()
  42. {
  43. register_plugin(Get_Info[PluginName], Get_Info[PluginVersion], "Jhob94")
  44.  
  45. register_dictionary("adminslots.txt")
  46.  
  47. register_cvar(Get_Info[PluginName], Get_Info[PluginVersion], FCVAR_SPONLY|FCVAR_SERVER)
  48. set_cvar_string(Get_Info[PluginName], Get_Info[PluginVersion])
  49.  
  50. slots = register_cvar("ssr_amount", "1") // Amount of slots to reservate
  51.  
  52. maxplayers = get_maxplayers()
  53. }
  54.  
  55. public client_authorized(id)
  56. {
  57. if(!access(id, ADMIN_RESERVATION))
  58. {
  59. new limit, players, admins_online, normal_players
  60.  
  61. limit = maxplayers - get_pcvar_num(slots)
  62.  
  63. players = get_playersnum(1)
  64. admins_online = get_reserved_admins_num()
  65. normal_players = players - admins_online
  66.  
  67. if(normal_players > limit)
  68. {
  69. new KickMessage[100]
  70. formatex(KickMessage, charsmax(KickMessage), "%L", id, "DROPPED_RES")
  71.  
  72. message_begin(MSG_ONE, SVC_DISCONNECT,_, id)
  73. write_string(KickMessage)
  74. message_end()
  75. }
  76. }
  77. }
  78.  
  79. get_reserved_admins_num()
  80. {
  81. new players[32], num, admins
  82.  
  83. admins = 0
  84. get_players(players, num, "ch")
  85.  
  86. if(num)
  87. {
  88. for(new i = 0; i < num; i++)
  89. {
  90. if(access(players[i], ADMIN_RESERVATION)) admins++
  91. }
  92. }
  93.  
  94. return admins
  95. }