Raised This Month: $12 Target: $400
 3% 

[TF2] Unassigned Player Kicker (v3.0)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
404UserNotFound
BANNED
Join Date: Dec 2011
Plugin ID:
3540
Plugin Version:
3.0
Plugin Category:
Server Management
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
    3 
    Plugin Description:
    Small little plugin that prevents people from just sitting on the team selection screen to idle. Could also be useful on other, non-idle servers...
    Old 02-20-2013 , 22:21   [TF2] Unassigned Player Kicker (v3.0)
    Reply With Quote #1

    Introduction
    This plugin kicks people who waste a player slot by sitting on the team selection screen to idle. I've encountered players doing this many times, and it is incredibly annoying.

    ConVars
    • sm_unassignedkicker_version - Standard version ConVar, nothing to see here.
    • sm_unassignedkicker_timer - How long (in seconds) should the timer be, before it checks the connected player's team? (Default = 600.0 seconds, equal to 10 minutes)
    • sm_unassignedkicker_message - What do you want the kick reason to say? (Default = "If you return, please join a team")
    Oh, and just a side-note about the message ConVar: You do not need to add a period to your kick message. The game automatically adds one. For example, if you set your kick message to "Please join a team.", it'll show up as "Please join a team.." to people who get kicked.


    Installation
    1. Download unassignedplayerkicker.smx
    2. Place the file in sourcemod/plugins folder.
    3. Set up the timer and message ConVars in your server.cfg file
    4. Load the plugin up ingame via RCON (rcon sm plugins load unassignedplayerkicker.smx)
    5. ???
    6. Profit!


    Change Log
    Spoiler
    Attached Files
    File Type: sp Get Plugin or Get Source (unassignedplayerkicker.sp - 868 views - 2.2 KB)

    Last edited by 404UserNotFound; 10-20-2015 at 01:36. Reason: Updating!
    404UserNotFound is offline
    ddhoward
    Veteran Member
    Join Date: May 2012
    Location: California
    Old 02-21-2013 , 09:24   Re: [TF2] Unassigned Player Kicker (v1.0)
    Reply With Quote #2

    https://forums.alliedmods.net/showthread.php?t=163291

    This plugin forces all spectating/unassigned players to join a team and class, even if the player had not joined a team since connecting.
    ddhoward is offline
    Dr. McKay
    Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
    Join Date: Aug 2011
    Location: Atlantis
    Old 02-26-2013 , 19:40   Re: [TF2] Unassigned Player Kicker (v1.1)
    Reply With Quote #3

    Some issues:

    On line 58, you create a (default) 10-minute timer and pass a client index as the timer's parameter. When using timers or asynchronous callbacks, you need to pass the client's user ID (GetClientUserId) or serial (GetClientSerial), and use GetClientOfUserId or GetClientFromSerial to get a client index out of it. By passing a client index, if the client disconnects before the timer elapses, someone else might take their slot and be improperly kicked.

    Your else statement on line 83 is pointless.

    Your IsValidTeam stock is unnecessarily complex. You can just check if the client's team == 0 and return false. Or, for minimum lines of code:

    PHP Code:
    bool:IsValidTeam(client) {
        return (
    GetClientTeam(client) != 0);

    __________________
    Dr. McKay is offline
    404UserNotFound
    BANNED
    Join Date: Dec 2011
    Old 02-26-2013 , 21:51   Re: [TF2] Unassigned Player Kicker (v1.1)
    Reply With Quote #4

    Quote:
    Originally Posted by Dr. McKay View Post
    Some issues:

    On line 58, you create a (default) 10-minute timer and pass a client index as the timer's parameter. When using timers or asynchronous callbacks, you need to pass the client's user ID (GetClientUserId) or serial (GetClientSerial), and use GetClientOfUserId or GetClientFromSerial to get a client index out of it. By passing a client index, if the client disconnects before the timer elapses, someone else might take their slot and be improperly kicked.

    Your else statement on line 83 is pointless.

    Your IsValidTeam stock is unnecessarily complex. You can just check if the client's team == 0 and return false. Or, for minimum lines of code:

    PHP Code:
    bool:IsValidTeam(client) {
        return (
    GetClientTeam(client) != 0);

    Thank you very much for this info, I'm currently using the current iteration of this plugin on my server, so I guess I'll have to remove it for the time being and fix it up.

    I've fixed the latter two issues, but the first one is a tad confusing for me. How exactly am I meant to implement GetClientOfUserId or GetClientFromSerial?

    Last edited by 404UserNotFound; 02-26-2013 at 21:54.
    404UserNotFound is offline
    Dr. McKay
    Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
    Join Date: Aug 2011
    Location: Atlantis
    Old 02-26-2013 , 22:31   Re: [TF2] Unassigned Player Kicker (v1.1)
    Reply With Quote #5

    Quote:
    Originally Posted by abrandnewday View Post
    Thank you very much for this info, I'm currently using the current iteration of this plugin on my server, so I guess I'll have to remove it for the time being and fix it up.

    I've fixed the latter two issues, but the first one is a tad confusing for me. How exactly am I meant to implement GetClientOfUserId or GetClientFromSerial?
    PHP Code:
    //Event: Player is in the game
    public OnClientPutInServer(client)
    {
        
    CreateTimer(GetConVarFloat(g_hConVarTimer), Timer_CheckPlayerTeamGetClientUserId(client));
    }

    //Timer: Check the player's team
    public Action:Timer_CheckPlayerTeam(Handle:timerany:userid)
    {
        new 
    client GetClientOfUserId(userid);
        
    //First let's make sure the player's still in the game.
        
    if (client == 0)
        {
            
    //They aren't in the game anymore, so we'll return this as handled.
            
    return Plugin_Handled;
        }

            
    // . . . . . 
    __________________
    Dr. McKay is offline
    404UserNotFound
    BANNED
    Join Date: Dec 2011
    Old 02-27-2013 , 11:20   Re: [TF2] Unassigned Player Kicker (v1.1)
    Reply With Quote #6

    Quote:
    Originally Posted by Dr. McKay View Post
    PHP Code:
    //Event: Player is in the game
    public OnClientPutInServer(client)
    {
        
    CreateTimer(GetConVarFloat(g_hConVarTimer), Timer_CheckPlayerTeamGetClientUserId(client));
    }

    //Timer: Check the player's team
    public Action:Timer_CheckPlayerTeam(Handle:timerany:userid)
    {
        new 
    client GetClientOfUserId(userid);
        
    //First let's make sure the player's still in the game.
        
    if (client == 0)
        {
            
    //They aren't in the game anymore, so we'll return this as handled.
            
    return Plugin_Handled;
        }

            
    // . . . . . 
    Ahhh. I see. Should've known it was this way

    Thanks for the tips
    404UserNotFound is offline
    404UserNotFound
    BANNED
    Join Date: Dec 2011
    Old 03-05-2013 , 20:31   Re: [TF2] Unassigned Player Kicker (v1.2)
    Reply With Quote #7

    Updated to v1.2! Credit goes to Dr. McKay for showing me the little issues that this could've caused.
    404UserNotFound is offline
    ProTravis
    Junior Member
    Join Date: Feb 2012
    Old 04-04-2013 , 21:38   Re: [TF2] Unassigned Player Kicker (v1.2)
    Reply With Quote #8

    hey there, my server owner uses your plugin and it works like a charm, the only thing is that there isnt an option to skip admins or other flags when it checks, which is abit of a problem for us because our admins like to use the unnassigned team quite a lot, (being on unnassigned and then respawining and get booted after a short while on it
    if you could add an option to ignore admin flags, that would be a wonderful addition
    thanks
    ProTravis is offline
    404UserNotFound
    BANNED
    Join Date: Dec 2011
    Old 04-05-2013 , 03:48   Re: [TF2] Unassigned Player Kicker (v1.2)
    Reply With Quote #9

    Quote:
    Originally Posted by ProTravis View Post
    hey there, my server owner uses your plugin and it works like a charm, the only thing is that there isnt an option to skip admins or other flags when it checks, which is abit of a problem for us because our admins like to use the unnassigned team quite a lot, (being on unnassigned and then respawining and get booted after a short while on it
    if you could add an option to ignore admin flags, that would be a wonderful addition
    thanks
    Sure thing! Easy addition. I'm just heading to bed for the night, but I'll get 'er done tomorrow.
    404UserNotFound is offline
    ProTravis
    Junior Member
    Join Date: Feb 2012
    Old 04-09-2013 , 04:37   Re: [TF2] Unassigned Player Kicker (v1.2)
    Reply With Quote #10

    hey, have you included the admin flag suggestion? just making sure you didnt forget about the little suggestion i made
    thanks
    ProTravis 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:09.


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