Raised This Month: $ Target: $400
 0% 

Advanced slot reservation


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Server Management       
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 01-03-2022 , 17:19   Advanced slot reservation
Reply With Quote #1

Advanced slot reservation


Informations
Description
This script can detect if the player's Name, Password or IP Address is reserved and it automatically kicks a random player ( in accordance with settings, player can be non-admin / admin and bot or hltv proxy ) from server, only if the server is full. In order to do that, sv_visiblemaxplayers has to be more than maxplayers.
It is compatible with dynamic admins storage, such as users.ini, amxbans, etc ).
Requirements
  • AmxModX 1.8.2+
  • HLDS ( Build: 8684+ ) or ReHLDS ( Version: 3.11.0.767+ )
  • For ReHLDS: ReAPI Module ( Version: 5.21.0.248+ )
  • For HLDS: Orpheu Module
Installation
  • Download the archive from down below.
  • Compile advanced_slot_reservation.sma using a local compiler or a web compiler.
  • Put advanced_slot_reservation.amxx in amxmodx/plugins folder
  • Go to amxmodx/configs/plugins.ini, open the file and write on the last line advanced_slot_reservation.amxx.
  • Step ONLY for HLDS:
    • Add SV_ConnectClient signature file to configs/orpheu/functions
  • Restart your server or change the map and you're ready to go.
API
PHP Code:
/* Sublime AMXX Editor v4.2 */

#if defined _adv_slot_reservation_included
    #endinput
#endif
#define _adv_slot_reservation_included

#if !defined MAX_NAME_LENGTH 
#define MAX_NAME_LENGTH 32
#endif

#if !defined MAX_IP_LENGTH
#define MAX_IP_LENGTH 16
#endif

#if !defined MAX_PLAYERS
#define MAX_PLAYERS 32
#endif

/* Engine const https://github.com/dreamstalker/rehlds/blob/master/rehlds/engine/info.h#L37 */
#define MAX_INFO_STRING 256

#define MAX_STRING 256

#define MAX_USER_INFO_PASSWORD 34

/* Custom return values */
enum (+=250)
{
    
SLOT_KICK_NO 0,
    
SLOT_KICK_YES
};

enum _:PlayerData
{
    
#if defined USE_REAPI
    
szIP[MAX_IP_LENGTH],
    
#endif
    
szName[MAX_NAME_LENGTH],
    
szPassword[MAX_USER_INFO_PASSWORD]
};

/**
 * @description                Multiforward called before a player will be kicked to free a player slot.
 *
 * @param id                Choosen player to be kicked index.
 * @param szPlayerData        Array which contains data of the reserved client.
 * 
 * @return                    Return SLOT_KICK_YES if you want to not let the plugin kick the player or SLOT_KICK_NO to continue executing.
 */
forward player_kick_pre(idszPlayerData[PlayerData]);

/**
 * @description                Multiforward called right before a player will be kicked to free a player slot.
 *
 * @param id                Choosen player to be kicked index.
 * @param szPlayerData        Array which contains data of the reserved client.
 * 
 * @return                    Forward ignores return values.
 */
forward player_kick_post(idszPlayerData[PlayerData]);

/**
 * @description                Multiforward called after the player array was sorted.
 *
 * @param szPlayers            Array which contains player's indexes.
 * @param iTotalPlayers        Total of players included in the sorting algorithm.
 * 
 * @note                    Array will be passed in kicking function with the changes made inside this forward.
 * 
 * @return                    Forward ignores return values.
 */
forward player_check_playtime(szPlayers[MAX_PLAYERS], iTotalPlayers);

/* Support for AmxModX versions lower that 1.8.3 */
#if AMXX_VERSION_NUM < 183
enum GetPlayersFlags (<<= 1)
{
    
GetPlayers_None 0,           // No filter (Default)
    
GetPlayers_ExcludeDead 1,    // Do not include dead clients
    
GetPlayers_ExcludeAlive,       // Do not include alive clients
    
GetPlayers_ExcludeBots,        // Do not include bots
    
GetPlayers_ExcludeHuman,       // Do not include human clients
    
GetPlayers_MatchTeam,          // Match with team
    
GetPlayers_MatchNameSubstring// Match with part of name
    
GetPlayers_CaseInsensitive,    // Match case insensitive
    
GetPlayers_ExcludeHLTV,        // Do not include HLTV proxies
    
GetPlayers_IncludeConnecting   // Include connecting clients
};

stock get_players_ex(players[MAX_PLAYERS] = {}, &numGetPlayersFlags:flags GetPlayers_None, const team[] = "")
{
    new 
strFlags[10];
    
get_flags(_:flagsstrFlagscharsmax(strFlags));
    
get_players(playersnumstrFlagsteam);
}

stock get_playersnum_ex(GetPlayersFlags:flags GetPlayers_None, const team[] = "")
{
    new 
PlayersNum;
    
get_players_ex(_PlayersNumflagsteam);
    return 
PlayersNum;
}
#endif 
To Do
  • If all slots are used, ability to search a player to kick based on certain criteria (spectator, defined afk time, etc) - Idea took from "New features in plugins" from GitHub. Done!
  • Improve detection. Done!
ChangeLog

FULL Changelog can be found HERE
  • Version 1.0:
    • Initial Release
  • Version 1.1:
    -
    • Added reservation type either by IP address or name.
    • Added some settings for connected players checking.
    • Added parsing player's name in SV_ConnectClient hook ( Thanks HamletEagle for showing me this way https://forums.alliedmods.net/showpo...9&postcount=13 ).
    • Improved connected players checking code.
  • Version 1.2:
    • Implemented a new reservation method:
    • Implemented more methods for the kicking player algorithm:
      • Kick only from spectators. If there is no spectator, then go to the next search method.
      • Kick player by played time ( the oldest player on the server or the newest player on the server ).
    • Added admin immunity flag in configuration file ( which flag should be skipped from algorithm ).
    • Added kick message field in configuration file.
  • Version 1.3:
    • Added support for VGUI connect ( like before but customizable, read description in config file ).
    • Removed SV_ConnectClient execute parameter (id) because it isn't passed from hook and renamed function name.
  • Version 1.4:
    • Added support for dynamiclly stored admins ( such as users.ini, SQL Admins, AmxBans too ) ( except those which have SteamID as auth data because player's steamID can't be retrieved in SV_ConnectClient hook ).
    • Thanks to PomanoB & droper for the idea.
    • Improved a little set_visible_players() function.
  • Version 1.5:
    • Added API to plugin:
      • Added player_kick_pre() forward which is called before a player will be kicked.
      • Added player_kick_post() forward which is called right before a player is kicked.
      • Added player_check_playtime() forward which is called after player's indexes array was sorted.
    • Added an API test plugin.
    • Added a new ADMIN_SUPPORT value ( updated in documentation from the config file ).
  • Version 1.6:
    • Added compatibility support for AmxModX 1.8.2.
  • Version 1.7:
    • Fixed SQL dynamic admins support
  • Version 1.8:
  • Version 1.9:
    • Fixed password and name support.
    • Fixed VGUI Support if there are less than maxplayers.
  • Version 2.0:
    • Fixed an issue when there is no player selected
  • Version 2.1:
    • Fixed IP and Password reservation types.
  • Version 2.2:
    • Added HLDS Support
      • IP reservation can't be achieved on HLDS ( or at least I couldn't find any method ).
Orpheu Signature for SV_ConnectClient ( Only for HLDS )
Code:
{
    "name" : "SV_ConnectClient",
    "library" : "engine",
    "identifiers" :
    [
        {
            "os" : "windows",
            "value" : [0x55,0x8B,0xEC,0x81,"*","*","*","*","*",0x53,0x56,0x57,0xB9,0x05,0x00,0x00,0x00,0xBE,"*","*","*","*",0x8D,"*","*",0x33,0xDB,0x68,"*","*","*","*"]
        },
        {
            "os" : "linux",
            "value" : "SV_ConnectClient"
        }
    ]
}
GitHub Project

DOWNLOAD SOURCE CODE

DOWNLOAD COMPILED PLUGIN
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]

Last edited by Shadows Adi; 02-15-2022 at 10:56. Reason: Update version 2.2
Shadows Adi is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 01-03-2022 , 17:40   Re: [ReAPI] Advanced slot reservation
Reply With Quote #2

Quote:
Originally Posted by Shadows Adi View Post
Advanced slot reservation


Informations
Description
This script can detect if the player's IP Address is reserved and it automatically kicks a non-admin player from server, only if the server is full. In order to do that, sv_visiblemaxplayers has to be more than maxplayers.
Requirements
  • AmxModX 1.8.2+
  • ReAPI Module ( reHLDS Needed )
Installation
  • Download the archive from down below.
  • Compile advanced_slot_reservation.sma using a local compiler or a web compiler.
  • Put advanced_slot_reservation.amxx in amxmodx/plugins folder
  • Go to amxmodx/configs/plugins.ini, open the file and write on the last line advanced_slot_reservation.amxx.
  • Restart your server or change the map and you're ready to go.
To Do
  • If all slots are used, ability to search a player to kick based on certain criteria (spectator, defined afk time, etc) - Idea took from "New features in plugins" from GitHub.
  • Improve the code.
ChangeLog

FULL Changelog can be found HERE
  • Version 1.0:
    • Initial Release
GitHub Project

DOWNLOAD SOURCE CODE
Why ip and not steamid? Not many people have static ip's, most have dynamic.
DarthMan is offline
Mordekay
Squirrel of Fortune
Join Date: Apr 2006
Location: Germany
Old 01-03-2022 , 17:50   Re: [ReAPI] Advanced slot reservation
Reply With Quote #3

Where is this plugin "advanced" compared to the original plugin?
How can a player's IP be "reserved"? Either it is an IP listed in admins.ini as possible IP of an admin (and probably set this player to admin) or not.
Why all this re-crap? Everything needed in this plugin can be done with amxmodx, no special module needed.
The only thing positive against the original plugin would be the ability to define the criteria which player to kick if an admin wants to join, but this is currently only on the to-do list. So your plugin is, well, useless.
__________________

Mordekay is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 01-03-2022 , 18:00   Re: [ReAPI] Advanced slot reservation
Reply With Quote #4

Quote:
Originally Posted by Mordekay View Post
Where is this plugin "advanced" compared to the original plugin?
How can a player's IP be "reserved"? Either it is an IP listed in admins.ini as possible IP of an admin (and probably set this player to admin) or not.
Why all this re-crap? Everything needed in this plugin can be done with amxmodx, no special module needed.
The only thing positive against the original plugin would be the ability to define the criteria which player to kick if an admin wants to join, but this is currently only on the to-do list. So your plugin is, well, useless.
Also I guess I know why he used the ip method, although I'm not gonna say it.
He probably wanted a plugin that uses reapi because it's faster, but it really doesn't make any sense at all, there's little difference, unnoticeable and PC's are so powerful these days that such optimizations are not even needed.
DarthMan is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 01-03-2022 , 18:31   Re: [ReAPI] Advanced slot reservation
Reply With Quote #5

1. I am using IP reservation until I think at a better method to achieve everything.
2. I am using reapi because of it's hook of SV_ClientConnect.
3. It's not achievable with only amxmodx, either orpheu or reapi to hook SV_ClientConnect, because it will kick a player if the server is full. And you won't get "Server is full!" message if your IP is "reserved". Not any hide slots or reserved slots, etc. If the number of connected players is equal with the max players number, any other plugin won't do anything unless you:
- reserve a slot.
- kick afk players or any other criteria based players by setting a task or something.

Try the plugin while server has all slots occupied and you will see what I mean. Or just look at comments I left in source code.

And no, it's not faster, I explained why I use this. I don't use orpheu, because rehlds based servers need new signatures for every version released.
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]

Last edited by Shadows Adi; 01-03-2022 at 18:39.
Shadows Adi is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-03-2022 , 19:46   Re: [ReAPI] Advanced slot reservation
Reply With Quote #6

Quote:
Originally Posted by Shadows Adi View Post
1. I am using IP reservation until I think at a better method to achieve everything.
2. I am using reapi because of it's hook of SV_ClientConnect.
3. It's not achievable with only amxmodx, either orpheu or reapi to hook SV_ClientConnect, because it will kick a player if the server is full. And you won't get "Server is full!" message if your IP is "reserved". Not any hide slots or reserved slots, etc. If the number of connected players is equal with the max players number, any other plugin won't do anything unless you:
- reserve a slot.
- kick afk players or any other criteria based players by setting a task or something.

Try the plugin while server has all slots occupied and you will see what I mean. Or just look at comments I left in source code.

And no, it's not faster, I explained why I use this. I don't use orpheu, because rehlds based servers need new signatures for every version released.
1. STEAM ID
2. client_putinserver / client_authorized / client_connect
3. I'm not certain about this, but how about kicking a player on client_connect when the admin with reservation is still connecting?

This plugin is certainly not "Advanced". Add more features to it than the regular amxmodx reservation system has, and it MIGHT have a chance of becoming useful.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 01-03-2022 , 23:16   Re: [ReAPI] Advanced slot reservation
Reply With Quote #7

Quote:
Originally Posted by Shadows Adi View Post
1. I am using IP reservation until I think at a better method to achieve everything.
2. I am using reapi because of it's hook of SV_ClientConnect.
3. It's not achievable with only amxmodx, either orpheu or reapi to hook SV_ClientConnect, because it will kick a player if the server is full. And you won't get "Server is full!" message if your IP is "reserved". Not any hide slots or reserved slots, etc. If the number of connected players is equal with the max players number, any other plugin won't do anything unless you:
- reserve a slot.
- kick afk players or any other criteria based players by setting a task or something.

Try the plugin while server has all slots occupied and you will see what I mean. Or just look at comments I left in source code.

And no, it's not faster, I explained why I use this. I don't use orpheu, because rehlds based servers need new signatures for every version released.
3 - And why not use client_connectex(id, const name[], const ip[], reason[128])?
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 01-04-2022 , 00:45   Re: [ReAPI] Advanced slot reservation
Reply With Quote #8

Quote:
Originally Posted by iceeedr View Post
3 - And why not use client_connectex(id, const name[], const ip[], reason[128])?
Read again the 3rd point.
client_connectex(), client_connect(), client_putinserver() are not called from SV_ConnectClient hook, check the code ng yourself.
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]

Last edited by Shadows Adi; 01-04-2022 at 00:47.
Shadows Adi is offline
Mordekay
Squirrel of Fortune
Join Date: Apr 2006
Location: Germany
Old 01-04-2022 , 03:29   Re: [ReAPI] Advanced slot reservation
Reply With Quote #9

Quote:
Originally Posted by Shadows Adi View Post
Try the plugin while server has all slots occupied and you will see what I mean. Or just look at comments I left in source code.
Impossible for anyone with dynamic IP, as the only recommended method to get admin is not supported by your "advanced" plugin.
Darthman doesn't want to tell it what it is, but I do: it's a stupid plugin designed for non-steamers.
__________________


Last edited by Mordekay; 01-04-2022 at 03:30.
Mordekay is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 01-04-2022 , 05:38   Re: [ReAPI] Advanced slot reservation
Reply With Quote #10

Quote:
Originally Posted by Mordekay View Post
Impossible for anyone with dynamic IP, as the only recommended method to get admin is not supported by your "advanced" plugin.
I know about dynamic IPs, but, how I said, this is the current method until I find something I can use from hook.

Quote:
Originally Posted by Mordekay View Post
Darthman doesn't want to tell it what it is, but I do: it's a stupid plugin designed for non-steamers.
If you say so, I don't support non-steam, Amxmodx has a slot reservation plugin which works for admins too, but you can use it with IPs too, so I don't see where is the non-steam support for this.
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]

Last edited by Shadows Adi; 01-04-2022 at 05:39.
Shadows Adi is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:06.


Powered by vBulletin®
Copyright ©2000 - 2022, vBulletin Solutions, Inc.
Theme made by Freecode