/*
SIMPLE SLOTS RESERVATION v0.0.7
Simple Slots Reservation is a plugin that allow you to reservate slots at your server.
But unlike AMXX's reservation slots plugin, this version does NOT reservate the slots all the time.
With AMXX's version if you have 1 reservated slot, it will reservate the slot all the time, wich means:
- The server might have admins connected, but it still reservating the slot.
With this version if you have 1 reservated slot, it will only reservate the slot if there are not any admin connected, wich means:
- Non-admins will be able to join the server if there is already 1 admin connected.
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.
Advantage:
- Your players will be happy for don't get kicked when there are already enough admins connected at the server.
Cvar: ssr_amount "#"
# = Amount of slots you want to reservate
Credits:
- AMXX Develop Team - Base Code & ML File
- pokemonmaster - Kick Stock
- Backstabnoob - Scripting Suggestions
- The AMXX's Bible aka Arkshine - Scripting Suggestions
*/
#include <amxmodx>
#include <amxmisc>
enum _:PluginInfo {
PluginName,
PluginVersion
}
new const Get_Info[PluginInfo][] =
{
"Simple Slots Reservation",
"0.0.7"
}
new slots, maxplayers
public plugin_init()
{
register_plugin(Get_Info[PluginName], Get_Info[PluginVersion], "Jhob94")
register_dictionary("adminslots.txt")
register_cvar(Get_Info[PluginName], Get_Info[PluginVersion], FCVAR_SPONLY|FCVAR_SERVER)
set_cvar_string(Get_Info[PluginName], Get_Info[PluginVersion])
slots = register_cvar("ssr_amount", "1") // Amount of slots to reservate
maxplayers = get_maxplayers()
}
public client_authorized(id)
{
if(!access(id, ADMIN_RESERVATION))
{
new limit, players, admins_online, normal_players
limit = maxplayers - get_pcvar_num(slots)
players = get_playersnum(1)
admins_online = get_reserved_admins_num()
normal_players = players - admins_online
if(normal_players > limit)
{
new KickMessage[100]
formatex(KickMessage, charsmax(KickMessage), "%L", id, "DROPPED_RES")
message_begin(MSG_ONE, SVC_DISCONNECT,_, id)
write_string(KickMessage)
message_end()
}
}
}
get_reserved_admins_num()
{
new players[32], num, admins
admins = 0
get_players(players, num, "ch")
if(num)
{
for(new i = 0; i < num; i++)
{
if(access(players[i], ADMIN_RESERVATION)) admins++
}
}
return admins
}