Thread: Plugin request
View Single Post
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-22-2022 , 15:22   Re: Plugin request
Reply With Quote #4

...not sure how this should work.
But from server, I used mp_disable_autokick userid to myself and I called votekick to myself, it works.
But not work other way.

When using rcon (or server set mp_disable_autokick to player), it grant player as "admin", in SRCDS. Not SourceMod.

*edit
Thats odd... now it works without "disable autokick" feature. But I had virtual servers LAN connections before, disturbing my rcon connection to SRCDS.
Maybe if you have same IP as SRCDS it works.

*edit
This problem happen in same LAN ?

*edit
Something odd happened, and I can't re-process that again... now it works fine.


*edit
Try this
PHP Code:



public void OnPluginStart()
{
    
// When vote start, vote starter and target made vote in same tick.
    
HookEvent("vote_started"vote_started); // issue #L4D_vote_kick_player
    
HookEvent("vote_cast_yes"vote_started);
    
HookEvent("vote_cast_no"vote_started);
    
HookEvent("vote_failed"vote_started);
    
HookEvent("vote_passed"vote_started); // details #L4D_vote_passed_kick_player
}

public 
void vote_started(Event event, const char[] namebool dontBroadcast)
{
    static 
int tick 0;
    static 
int target 0;


    if(
StrEqual(name"vote_started"false))
    {
        
char buffer[30];
        
event.GetString("issue"buffersizeof(buffer), " ");

        if(
StrEqual(buffer"#L4D_vote_kick_player"false))
        {
            
tick GetGameTickCount();
        }
        return;
    }
    else if(
StrEqual(name"vote_passed"false))
    {
        
char buffer[30];
        
event.GetString("details"buffersizeof(buffer), " ");

        if(
StrEqual(buffer"#L4D_vote_passed_kick_player"false))
        {
            
//KickClient(GetClientOfUserId(target), "You have been voted off");
            
CreateTimer(10.0delaytarget);
        }

        
//return;
    
}
    else if(
StrEqual(name"vote_cast_yes"false))
    {
        if(
GetGameTickCount() == tick)
        {
            
target GetClientUserId(event.GetInt("entityid")); // If vote starter vote itself
        
}

        return;
    }
    else if(
StrEqual(name"vote_cast_no"false))
    {
        if(
GetGameTickCount() == tick)
        {
            
target GetClientUserId(event.GetInt("entityid"));
        }

        return;
    }

    
target 0;
}


public 
Action delay(Handle timerany userid)
{
    
int target GetClientOfUserId(userid);

    
// Works only if client is still in server
    
if(target && IsClientConnected(target) && !IsClientInKickQueue(target))
    {
        
KickClient(target"You have been voted off");
    }

    return 
Plugin_Continue;

__________________
Do not Private Message @me

Last edited by Bacardi; 04-22-2022 at 20:38.
Bacardi is offline