Raised This Month: $32 Target: $400
 8% 

[L4D & L4D2] Kick Load Stuckers


Post New Thread Reply   
 
Thread Tools Display Modes
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 09-12-2009 , 10:31   Re: [L4D] Kick Load Stuckers
Reply With Quote #11

It doesn't work because the Handle appears Valid to the "!= INVALID_HANDLE" check, but the adress is invalid already because the server resets. I've now simply replaced the instant Timer Killings with 1 second delayed ones, which wont fire anymore if the Server was reset.
AtomicStryker is offline
Ja-Forces
Senior Member
Join Date: Jul 2009
Location: Leningrad
Old 09-13-2009 , 01:58   Re: [L4D] Kick Load Stuckers
Reply With Quote #12

ok ... nice plugin, but u can clean debug messages?
Ja-Forces is offline
bobbobagan
SourceMod Donor
Join Date: May 2007
Location: New Zealand
Old 09-13-2009 , 12:35   Re: [L4D] Kick Load Stuckers
Reply With Quote #13

Will this work on TF2? I have noticed it happening on there as well.
__________________
bobbobagan is offline
Send a message via Skype™ to bobbobagan
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 09-13-2009 , 13:25   Re: [L4D] Kick Load Stuckers
Reply With Quote #14

There's no L4D specific code, but TF2 is a different case, because unlike L4D it allows custom content, which must be downloaded ... the Engine then takes quite some time to put the stuff in the right place ...

Short: You CAN, but i really suggest not mixing it with custom content. Or setting the kick timer rather high.
AtomicStryker is offline
Bongholio
Senior Member
Join Date: Sep 2009
Old 09-15-2009 , 14:14   Re: [L4D] Kick Load Stuckers
Reply With Quote #15

L 09/14/2009 - 00:03:20: [SM] Native "CloseHandle" reported: Handle eafd021e is invalid (error 3)
L 09/14/2009 - 00:03:20: [SM] Displaying call stack trace for plugin "l4d_kickloadstuckers.smx":
L 09/14/2009 - 00:03:20: [SM] [0] Line 101, /home/groups/alliedmodders/forums/files/5/2/2/3/3/49427.attach:elayedTimerKill()

dunno what it is but lot of them in console
and logfile non-dedicated campaign game
Bongholio is offline
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 09-15-2009 , 15:30   Re: [L4D] Kick Load Stuckers
Reply With Quote #16

Yes. I can't seem to get rid of those. They have no effect, they just spam your errorlog.
AtomicStryker is offline
D1maxa
Member
Join Date: Dec 2008
Old 09-21-2009 , 04:05   Re: [L4D] Kick Load Stuckers
Reply With Quote #17

may be next code instead of yours:
Code:
public Action:DelayedTimerKill(Handle:timer, any:client)
{
    if (CloseHandle(LoadingTimer[client])) LoadingTimer[client]= INVALID_HANDLE; //try closing it, then setting it invalid
}
and:
Code:
public Action:CheckClientIngame(Handle:timer, any:client)
{
    LoadingTimer[client] = INVALID_HANDLE;
    if (!IsClientConnected(client)) return; //onclientdisconnect should handle this, but you never know
    if (!IsClientInGame(client))
        {
            decl String:name[256];
            GetClientName(client, name, sizeof(name));
            PrintToChatAll("%s was kicked for being stuck in connecting state for 60 seconds", name);
            
            KickClient(client, "You were stuck Connecting for too long"); //he is connected but not ingame after an entire minute? SMITE HIM!!!
        }
}

Last edited by D1maxa; 09-21-2009 at 04:38.
D1maxa is offline
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 09-21-2009 , 04:57   Re: [L4D] Kick Load Stuckers
Reply With Quote #18

No, it won't help. Its a fundamental Problem - the Handles don't appear == INVALID_HANDLE to sourcemod, yet when it tries to use something like CloseHandle the address is invalid.
AtomicStryker is offline
olj
Veteran Member
Join Date: Jun 2009
Old 09-21-2009 , 05:09   Re: [L4D] Kick Load Stuckers
Reply With Quote #19

EDIT: Oh its not repeatable...anyway check below qestion )

EDIT: You use TIMER_FLAG_NO_MAPCHANGE, why you trying to kill them on map end??
__________________

Last edited by olj; 09-21-2009 at 05:16.
olj is offline
D1maxa
Member
Join Date: Dec 2008
Old 09-21-2009 , 05:46   Re: [L4D] Kick Load Stuckers
Reply With Quote #20

Full version:
Code:
#include <sourcemod>
#define PLUGIN_VERSION "1.1"
#pragma semicolon 1

public Plugin:myinfo = 
{
    name = "L4D Kick Load Stuckers",
    author = "AtomicStryker, edited by D1maxa",
    description = "Kicks Clients that get stuck in server connecting state",
    version = PLUGIN_VERSION,
    url = "http://forums.alliedmods.net/showthread.php?t=103203"
}

new Handle:LoadingTimer[MAXPLAYERS+1]; //= INVALID_HANDLE; // one Handle for each client
new Handle:CvarDuration = INVALID_HANDLE;


public OnPluginStart()
{
    RegAdminCmd("sm_kickloading", KickLoaders, ADMFLAG_KICK, "Kicks everyone Connected but not ingame");
    CreateConVar("l4d_kickloadstuckers_version", PLUGIN_VERSION, " Version of L4D Kick Load Stuckers on this server ", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD);
    CvarDuration = CreateConVar("l4d_kickloadstuckers_duration", "45", " How long before a connected but not ingame player is kicked. (default 45) ", FCVAR_PLUGIN|FCVAR_NOTIFY);
    
    for(new i=0;i<=MAXPLAYERS;i++)
        LoadingTimer[i]=INVALID_HANDLE;
}

public Action:KickLoaders(clients, args)
{
    for (new i = 1; i <= MaxClients; i++)
    {        
        if (IsClientConnected(i) && !IsClientInGame(i))
        {
            decl String:name[64];
            GetClientName(i, name, sizeof(name));
            PrintToChatAll("%s was admin kicked for being stuck in connecting state", name);
            
            KickClient(i, "You were stuck Connecting for too long");            
        }
    }
    return Plugin_Handled;
}

public OnClientConnected(client)
{
    LoadingTimer[client] = CreateTimer(GetConVarFloat(CvarDuration), CheckClientIngame, client, TIMER_FLAG_NO_MAPCHANGE); //on successfull connect the Timer is set in motion
}

public OnClientDisconnect(client)
{
    if(LoadingTimer[client]!=INVALID_HANDLE)
    {
        KillTimer(LoadingTimer[client]);
        LoadingTimer[client] = INVALID_HANDLE;
    }    
}

public Action:CheckClientIngame(Handle:timer, any:client)
{    
    LoadingTimer[client] = INVALID_HANDLE;
    if (IsClientConnected(client) && !IsClientInGame(client))
    {
        decl String:name[64];
        GetClientName(client, name, sizeof(name));
        PrintToChatAll("%s was kicked for being stuck in connecting state for %d seconds", name, GetConVarInt(CvarDuration));
        
        KickClient(client, "You were stuck Connecting for too long"); //he is connected but not ingame after an entire minute? SMITE HIM!!!
    }
}

public OnPluginEnd()
{
    for (new i = 1; i <= MaxClients; i++)
    {
        if(LoadingTimer[i]!=INVALID_HANDLE)
        {
            KillTimer(LoadingTimer[i]);           
            LoadingTimer[i] = INVALID_HANDLE;
        }
    }
}

Last edited by D1maxa; 09-21-2009 at 05:53.
D1maxa is offline
Reply



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:58.


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