Raised This Month: $ Target: $400
 0% 

[ANY] Map Slots Locker


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Plugin ID:
7921
Plugin Version:
1.3
Plugin Category:
Server Management
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    6 
    Plugin Description:
    Locks ability to join the server on specific maps or by command
    Old 01-14-2022 , 14:47   [ANY] Map Slots Locker
    Reply With Quote #1

    Author: Dragokas (idea by rin-ale).

    Description:
    • Prevents to join the server via temporarily locking the slots down to 1 on specified maps.
    • Specially designed to "walkaround/bypass" L4D custom maps "missing stringtable" crash*, happened when somebody join the map in the middle-game.
      * Also known in crash logs as:
      Quote:
      Host_Error: Overflow error writing string table baseline Scenes
    • You can use this plugin for developer purposes as well by locking the server via admin commands (slots aren't unlocked automatically in such case on map change).

    Map list is stored here (add new map names to lock the slots on them):
    • data/maplocker_list.txt

    Specific:
    • Only transitioned players are allowed to start playing that specific maps. Other players can no longer join the server until the map finishes.
    • Slots are hooked in a way preventing other plugins to change the value until map finishes.
    • You can find more information about the crash in the topic: https://github.com/ValveSoftware/Sou...es/issues/3451 | https://forums.alliedmods.net/showthread.php?t=305123
    • Bugged map names could be found in crash logs. See example in above topics.
    • At the moment list contains 23 L4D1 maps.
    • Please, report map names with a such bug to populate the list.

    TODO
    • There are more TODOs, intended for security improvements... not listed here for safe.

    Settings (ConVars):
    cfg/sourcemod/sm_maplocker.cfg:
    PHP Code:
    // Enable this plugin? (1 - Yes, 0 - No)
    sm_maplocker_enable "1" 
    Commands: ("z" flag)
    PHP Code:
    // Lock the map
    sm_maplock

    // Unlock the map
    sm_mapunlock 
    Installation
    - Unpack and copy everything to addons/sourcemod/
    ChangeLog:
    Spoiler


    Donate
    Donates are very appreciated and welcomed for further inspiration, make me happy, and make next updates came out more often:
    - Patreon (Paypal)
    - BitCoin
    - Ю.Money
    Attached Files
    File Type: zip MapLocker.zip (10.1 KB, 114 views)
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

    Last edited by Dragokas; 05-12-2022 at 05:09.
    Dragokas is offline
    Dragokas
    Veteran Member
    Join Date: Nov 2017
    Location: Ukraine on fire
    Old 01-28-2022 , 12:43   Re: [ANY] Map Slots Locker
    Reply With Quote #2

    Updated.

    Quote:
    1.1 (28-Jan-2022)
    - Added more map names to the list.
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
    Dragokas is offline
    Dragokas
    Veteran Member
    Join Date: Nov 2017
    Location: Ukraine on fire
    Old 02-21-2022 , 15:19   Re: [ANY] Map Slots Locker
    Reply With Quote #3

    Updated.

    Quote:
    1.2 (21-Feb-2022)
    - Added more map names to the list. Now: 16 L4D1 maps.
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
    Dragokas is offline
    Dragokas
    Veteran Member
    Join Date: Nov 2017
    Location: Ukraine on fire
    Old 05-12-2022 , 05:10   Re: [ANY] Map Slots Locker
    Reply With Quote #4

    Updated.

    Quote:
    1.3 (12-May-2022)
    - Added more map names to the list. Now: 23 L4D1 maps.
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
    Dragokas is offline
    cravenge
    Veteran Member
    Join Date: Nov 2015
    Location: Chocolate Factory
    Old 05-12-2022 , 12:12   Re: [ANY] Map Slots Locker
    Reply With Quote #5

    After some digging around, I think setting "sv_maxplayers" to 1 may not be a good idea at all since not only the slots are limited but also the global MaxClients variable of the game is changed as well and most internal functions rely on the UTIL_* ones that seek the value of this variable which in turn would cause some strange oddities.

    Maybe blocking mid-game connections through OnClientConnect (SM) / OnClientPreConnect (ConnectHook extension) would be a better solution?
    cravenge is offline
    Dragokas
    Veteran Member
    Join Date: Nov 2017
    Location: Ukraine on fire
    Old 05-12-2022 , 14:13   Re: [ANY] Map Slots Locker
    Reply With Quote #6

    Whaaaat? What is your test environment?

    PHP Code:
    public Action CmdMapLock(int clientint args)
    {
        
    PrintToChatAll("MaxClients (before) = %i"MaxClients);
        
    LockSlots();
        
    g_bSlotsLockedForce true;
        
    CPrintToChat(client"%t""slots_lock");
        
    PrintToChatAll("MaxClients (after) = %i"MaxClients);
        return 
    Plugin_Handled;
    }

    public 
    Action CmdMapUnlock(int clientint args)
    {
        
    PrintToChatAll("MaxClients (before) = %i"MaxClients);
        
    UnlockSlots();
        
    g_bSlotsLockedForce false;
        
    CPrintToChat(client"%t""slots_unlock");
        
    PrintToChatAll("MaxClients (after) = %i"MaxClients);
        return 
    Plugin_Handled;

    Attached Images
    File Type: jpg 1.jpg (7.7 KB, 158 views)
    File Type: jpg 2.jpg (15.5 KB, 107 views)
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
    Dragokas is offline
    Dragokas
    Veteran Member
    Join Date: Nov 2017
    Location: Ukraine on fire
    Old 05-12-2022 , 16:07   Re: [ANY] Map Slots Locker
    Reply With Quote #7

    But it is good to have opportunity to send some meaningful message to client instead of just locking.
    However, OnClientConnect may be too late. Need testing, which is not the easy part.
    Need concrete map, 2 people, and also bug is not always reproduced.
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
    Dragokas is offline
    cravenge
    Veteran Member
    Join Date: Nov 2015
    Location: Chocolate Factory
    Old 05-12-2022 , 21:27   Re: [ANY] Map Slots Locker
    Reply With Quote #8

    Quote:
    Originally Posted by Dragokas View Post
    Whaaaat? What is your test environment?

    PHP Code:
    public Action CmdMapLock(int clientint args)
    {
        
    PrintToChatAll("MaxClients (before) = %i"MaxClients);
        
    LockSlots();
        
    g_bSlotsLockedForce true;
        
    CPrintToChat(client"%t""slots_lock");
        
    PrintToChatAll("MaxClients (after) = %i"MaxClients);
        return 
    Plugin_Handled;
    }

    public 
    Action CmdMapUnlock(int clientint args)
    {
        
    PrintToChatAll("MaxClients (before) = %i"MaxClients);
        
    UnlockSlots();
        
    g_bSlotsLockedForce false;
        
    CPrintToChat(client"%t""slots_unlock");
        
    PrintToChatAll("MaxClients (after) = %i"MaxClients);
        return 
    Plugin_Handled;

    i don't mean SM's but rather the game's. I remember fiddling with UTIL_PlayerByIndex before.

    Whenever the maximum amount of available slots is changed, it's also reflected in that function. If "sv_maxplayers" is set to 1, it will only verify the first client as a valid player and invalidate everyone else. For SourceTV enabled servers, only the SourceTV bot will be verified.
    cravenge is offline
    cravenge
    Veteran Member
    Join Date: Nov 2015
    Location: Chocolate Factory
    Old 11-24-2022 , 21:11   Re: [ANY] Map Slots Locker
    Reply With Quote #9

    Update on my findings, saving the Steam IDs of clients who played in the previous map before it transitions to the faulty one and blocking newcomers with the use of OnClientPreConnect forward from ConnectHook extension seems to suffice as a bugless temporary fix for now since ConnectClient function runs before WriteBaselines.
    cravenge is offline
    Dragokas
    Veteran Member
    Join Date: Nov 2017
    Location: Ukraine on fire
    Old 11-25-2022 , 19:00   Re: [ANY] Map Slots Locker
    Reply With Quote #10

    Thank you. If that works, it must be a genius temporarily solution.
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
    Dragokas 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 23:18.


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