Raised This Month: $202 Target: $400
 50% 

[TF2] Unassigned Player Kicker (v3.0)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
404UserNotFound
( ͡ ͜ʖ ͡)
Join Date: Dec 2011
Location: 🍁
Plugin ID:
3540
Plugin Version:
3.0
Plugin Category:
Server Management
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
    22 
    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 - 168 views - 2.2 KB)
    __________________
    I'm not a SourcePawn expert, I just play one on TV.
    Want to join the new SourceMod Discord? Click here!


    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
    404UserNotFound
    ( ͡ ͜ʖ ͡)
    Join Date: Dec 2011
    Location: 🍁
    Old 02-21-2013 , 13:38   Re: [TF2] Unassigned Player Kicker (v1.0)
    Reply With Quote #3

    Quote:
    Originally Posted by ddhoward View Post
    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.
    Thanks for bringing that plugin to my attention. However, I checked the last page of that thread to see if there are any major issues with that plugin, and I found this post you made:

    Quote:
    Originally Posted by ddhoward View Post
    That seems to say that Pinion is actively searching for Auto DeSpectate, and if it finds it, Pinion turns off.

    There is nothing AutoDespectate can do. There is no conflict in coding or anything between Auto DeSpec and Pinion. Pinion is intentionally shutting down, intentionally blocking DeSpec. You will have to contact Pinion admins and ask that they stop blocking Auto DeSpectate.

    Of course, there may be ways around this blocking, but this is not the place to discuss it.

    EDIT: examining the coding of pinion_adverts.sp confirms this. The Pinion plugin has been intentionally written to shut down if plugins named "Open URL MOTD" or "Auto DeSpectate" are found on the server.
    So yeah, thanks again for letting me know about this plugin, but my plugin is different from DeSpectate and thus, should not have any issues with the Pinion MOTD plugin. Here's a breakdown for you:


    DeSpectate: Moves players onto a team. Does not kick players or have a method or toggleable convar to enable the kicking of players. Gets shut down by the Pinion MOTD because of the trying to move players to a team function.

    Unassigned Player Kicker: Kicks players if they haven't chosen a team within a set period of time. Does not switch players onto a team. Has no major issues with the Pinion MOTD, provided you don't set the timer to 30 seconds (cause then it'll kick the person before the 30 second PinionMOTD timer is up, and no-one will be able to get into your server).


    Onto my plugin. I've just uploaded v1.1 of the plugin which (hopefully) fixes that little "[SM] Native "GetClientTeam" reported: Client 3 is not in game
    " bug.
    __________________
    I'm not a SourcePawn expert, I just play one on TV.
    Want to join the new SourceMod Discord? Click here!


    Last edited by 404UserNotFound; 02-21-2013 at 14:27. Reason: Version 1.1 is out.
    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 , 19:40   Re: [TF2] Unassigned Player Kicker (v1.1)
    Reply With Quote #4

    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
    ( ͡ ͜ʖ ͡)
    Join Date: Dec 2011
    Location: 🍁
    Old 02-26-2013 , 21:51   Re: [TF2] Unassigned Player Kicker (v1.1)
    Reply With Quote #5

    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?
    __________________
    I'm not a SourcePawn expert, I just play one on TV.
    Want to join the new SourceMod Discord? Click here!


    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 #6

    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
    ( ͡ ͜ʖ ͡)
    Join Date: Dec 2011
    Location: 🍁
    Old 02-27-2013 , 11:20   Re: [TF2] Unassigned Player Kicker (v1.1)
    Reply With Quote #7

    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
    __________________
    I'm not a SourcePawn expert, I just play one on TV.
    Want to join the new SourceMod Discord? Click here!

    404UserNotFound is offline
    404UserNotFound
    ( ͡ ͜ʖ ͡)
    Join Date: Dec 2011
    Location: 🍁
    Old 03-05-2013 , 20:31   Re: [TF2] Unassigned Player Kicker (v1.2)
    Reply With Quote #8

    Updated to v1.2! Credit goes to Dr. McKay for showing me the little issues that this could've caused.
    __________________
    I'm not a SourcePawn expert, I just play one on TV.
    Want to join the new SourceMod Discord? Click here!

    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 #9

    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
    ( ͡ ͜ʖ ͡)
    Join Date: Dec 2011
    Location: 🍁
    Old 04-05-2013 , 03:48   Re: [TF2] Unassigned Player Kicker (v1.2)
    Reply With Quote #10

    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.
    __________________
    I'm not a SourcePawn expert, I just play one on TV.
    Want to join the new SourceMod Discord? Click here!

    404UserNotFound 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 15:49.


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