Aşağıda bıraktığım eklentiyi @ITenGriTR yazmıştı ancak bir sorun var. client_putinserver yerine client_authorized kullanılması gerekiyor çünkü oyuncular hata mesajını alana kadar başka oyuncuların gözünde specte gözüküyor buda benim için iyi bir şey değil.Yani eklenti çok iyi çalışıyor sadece bu kısmı değiştirmek gerekiyor. Ben kendimce değiştirmeyi denedim ancak sayıları tespit edemedi. Maç öncesi herkes specte beklediğinden ismin gözükmesi olmuyor. Bu yazılan eklentiye benzer eklentilere baktım hepsinde client_authorized kullanılmış onlarıda konunun altına koyacağım.(Onları kullanmıyorum çünkü istediğim gibi değil) Sizden isteğim bu eklentiyi client_authorized koduyla kullanılabilir hale getirmeniz teşekkürler.
Benzer Eklentiler:
Orijinal amx_reservation eklentisi:
Diğer reservation eklentileri:
PHP Kod:
/**
* Created by AMXX-Stuido
* User: ITenGriTR
* Date: 11.03.2020
* Time 20.20
*/
#include <amxmodx>
new iG_Cvars[2];
public plugin_init(){
register_plugin
("Naber",
"1.0",
"Berk");
new iL_Cvar,iL_Cvar2;
iL_Cvar = register_cvar("amx_oyuncusayisi","10");
iG_Cvars[0] = get_pcvar_num(iL_Cvar);
iL_Cvar2 = register_cvar("amx_adminsayisi ","2");
iG_Cvars[1] = get_pcvar_num(iL_Cvar2);
set_cvar_num("sv_visiblemaxplayers",iG_Cvars[0]+iG_Cvars[1]);
}
public client_putinserver(iP_ID){
new iL_Flag = get_user_flags(iP_ID),iL_LastProcess;
new iL_Status = iL_Flag & ADMIN_RESERVATION ? 1:2;
client_print(iP_ID,print_chat,"%i",iL_Status);
new sL_Players[32],iL_Num,iL_GetID,iL_PlayerFlags,iL_AdminCount,iL_PlayerCount;
get_players(sL_Players,iL_Num);
for(new i; i < iL_Num; i++){
iL_GetID = sL_Players[i];
iL_PlayerFlags = get_user_flags(iL_GetID);
iL_PlayerFlags & ADMIN_RESERVATION ? (iL_AdminCount++):(iL_PlayerCount++);
}
client_print(0,print_chat,"%i - %i",iL_AdminCount,iL_PlayerCount);
switch(iL_Status){
case 1 : {
if(iL_AdminCount > iG_Cvars[1]){
iL_LastProcess = 1;
}
}
case 2 : {
if(iL_PlayerCount > iG_Cvars[0]){
iL_LastProcess = 1;
}
}
}
if(iL_LastProcess == 1){
server_cmd("amx_kick %i ^"Server is full^"",get_user_userid(iP_ID));
}
}
Orijinal amx_reservation eklentisi:
PHP Kod:
/* AMX Mod X
* Slots Reservation Plugin
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
#include <amxmodx>
#include <amxmisc>
new g_ResPtr
new g_HidePtr
public plugin_init()
{
register_plugin("Slots Reservation", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("adminslots.txt")
register_dictionary("common.txt")
g_ResPtr = register_cvar("amx_reservation", "0")
g_HidePtr = register_cvar("amx_hideslots", "0")
}
public plugin_cfg()
{
set_task(3.0, "MapLoaded")
}
public MapLoaded()
{
if (!get_pcvar_num(g_HidePtr))
return
new maxplayers = get_maxplayers()
new players = get_playersnum(1)
new limit = maxplayers - get_pcvar_num(g_ResPtr)
setVisibleSlots(players, maxplayers, limit)
}
public client_authorized(id)
{
new maxplayers = get_maxplayers()
new players = get_playersnum(1)
new limit = maxplayers - get_pcvar_num(g_ResPtr)
if (access(id, ADMIN_RESERVATION) || (players <= limit))
{
if (get_pcvar_num(g_HidePtr) == 1)
setVisibleSlots(players, maxplayers, limit)
return PLUGIN_CONTINUE
}
new lReason[64]
format(lReason, 63, "%L", id, "DROPPED_RES")
server_cmd("kick #%d ^"%s^"", get_user_userid(id), lReason)
return PLUGIN_HANDLED
}
public client_disconnect(id)
{
if (!get_pcvar_num(g_HidePtr))
return PLUGIN_CONTINUE
new maxplayers = get_maxplayers()
setVisibleSlots(get_playersnum(1) - 1, maxplayers, maxplayers - get_pcvar_num(g_ResPtr))
return PLUGIN_CONTINUE
}
setVisibleSlots(players, maxplayers, limit)
{
new num = players + 1
if (players == maxplayers)
num = maxplayers
else if (players < limit)
num = limit
set_cvar_num("sv_visiblemaxplayers", num)
}
PHP Kod:
/*
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
}
PHP Kod:
/* AMX Mod X script.
*
* (c) 2003, OLO
* This file is provided as is (no warranties).
*
* Set you server max_players to 1 above the desirered value (ie. 21 or 33).
* Query programs will see max_players -1 as max. Admins with reservation
* can connect when there is 20/20 and player with worst ping or least play time
* will be kicked.
*
* Cvar:
* amx_reservation <value>
* 1 - Kicks the Player with shortest playing time when an admin connects to a full server.
* 2 - Kick the Player with the highest ping when an admin connects to a full server.
*/
#include <amxmodx>
#include <amxmisc>
// Comment if you don't want to hide true max_players
#define HIDE_RESERVEDSLOTS
public plugin_init()
{
register_plugin("Slots Reservation","0.9.7","f117bomb")
register_cvar("amx_maxplayers","31")
#if defined HIDE_RESERVEDSLOTS
set_cvar_num( "sv_visiblemaxplayers" , get_maxplayers() - 1 )
#endif
}
public client_authorized(id) {
new maxplayers = get_maxplayers()
new players = get_playersnum( 1 )
new limit = maxplayers - 1
new resType = get_cvar_num( "amx_reservation" )
new who
if ( players > limit ) //21/20
{
if ( get_user_flags(id) & ADMIN_RESERVATION )
{
switch(resType) {
case 1:
who = kickFresh()
case 2:
who = kickLag()
}
if(who) {
new name[32]
get_user_name( who, name , 31 )
client_cmd(id,"echo ^"* %s was kicked to free this slot^"" ,name )
}
return PLUGIN_CONTINUE
}
if ( is_user_bot(id) )
server_cmd("kick #%d", get_user_userid(id) )
else
client_cmd(id,"echo ^"Server is Full.^";disconnect")
return PLUGIN_HANDLED // block connect in other plugins (especially in consgreet)
}
return PLUGIN_CONTINUE
}
kickLag() {
new who = 0, ping, loss, worst = -1
new maxplayers = get_maxplayers()
for(new i = 1; i <= maxplayers; ++i) {
if ( !is_user_connected(i) && !is_user_connecting(i) )
continue // not used slot
if (get_user_flags(i)&ADMIN_RESERVATION)
continue // has reservation, skip him
get_user_ping(i,ping,loss) // get ping
if ( ping > worst ) {
worst = ping
who = i
}
}
if(who)
if ( is_user_bot(who) )
server_cmd("kick #%d", get_user_userid(who) )
else
client_cmd(who,"echo ^"Dropped due to high ping to free slot for an admin^";disconnect")
return who
}
kickFresh() {
new who = 0, itime, shortest = 0x7fffffff
new maxplayers = get_maxplayers()
for(new i = 1; i <= maxplayers; ++i){
if ( !is_user_connected(i) && !is_user_connecting(i) )
continue // not used slot
if (get_user_flags(i)&ADMIN_RESERVATION)
continue // has reservation, skip him
itime = get_user_time(i) // get user playing time with connection duration
if ( shortest > itime ) {
shortest = itime
who = i
}
}
if(who)
if ( is_user_bot(who) )
server_cmd("kick #%d", get_user_userid(who) )
else
client_cmd(who,"echo ^"Dropped due to shortest playing time to free slot for an admin^";disconnect")
return who
}
)

