AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [TF2] Unassigned Player Kicker (v3.0) (https://forums.alliedmods.net/showthread.php?t=209085)

404UserNotFound 02-20-2013 22:21

[TF2] Unassigned Player Kicker (v3.0)
 
1 Attachment(s)
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

ddhoward 02-21-2013 09:24

Re: [TF2] Unassigned Player Kicker (v1.0)
 
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.

Dr. McKay 02-26-2013 19:40

Re: [TF2] Unassigned Player Kicker (v1.1)
 
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);



404UserNotFound 02-26-2013 21:51

Re: [TF2] Unassigned Player Kicker (v1.1)
 
Quote:

Originally Posted by Dr. McKay (Post 1902709)
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?

Dr. McKay 02-26-2013 22:31

Re: [TF2] Unassigned Player Kicker (v1.1)
 
Quote:

Originally Posted by abrandnewday (Post 1902774)
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;
    }

        
// . . . . . 


404UserNotFound 02-27-2013 11:20

Re: [TF2] Unassigned Player Kicker (v1.1)
 
Quote:

Originally Posted by Dr. McKay (Post 1902785)
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 :P

Thanks for the tips :D

404UserNotFound 03-05-2013 20:31

Re: [TF2] Unassigned Player Kicker (v1.2)
 
Updated to v1.2! Credit goes to Dr. McKay for showing me the little issues that this could've caused.

ProTravis 04-04-2013 21:38

Re: [TF2] Unassigned Player Kicker (v1.2)
 
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

404UserNotFound 04-05-2013 03:48

Re: [TF2] Unassigned Player Kicker (v1.2)
 
Quote:

Originally Posted by ProTravis (Post 1926534)
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.

ProTravis 04-09-2013 04:37

Re: [TF2] Unassigned Player Kicker (v1.2)
 
hey, have you included the admin flag suggestion? just making sure you didnt forget about the little suggestion i made
thanks


All times are GMT -4. The time now is 09:00.

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