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

Solved Delay SB++ Ban on Client Disconnect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ShaneAJM
AlliedModders Donor
Join Date: Aug 2017
Location: United States
Old 09-24-2017 , 02:19   Delay SB++ Ban on Client Disconnect
Reply With Quote #1

EDIT: I posted this in the wrong section D: I can't find a way to delete it so if someone could let me know how/delete it for me that'd be awesome!

Hello, I'm trying to implement a system into 10 Mans/PUGs where if a user doesn't join back in x seconds they are issued a temporary ban via SourceBans++. I'm using PUGSetup for the gameplay so I'd like to only have it ban when the match is actually live so people don't get banned in warmup. I don't know if I'm able to hook events that are made by splewis' plugin or if I have to hook from CS:GO it's self.

I'm using most of Impact's code for a similar request that was made.

Lastly, I apologize for anyone's eyes I make bleed because of my scripting. I'm a noob.

Thanks for any help/feedback!

PHP Code:
#include <sourcemod>

new Handle:MK_Enabled INVALID_HANDLE

public Plugin:myinfo 
{
    
name "Matchkick",
    
author "Impact",
    
description "Bans a player when they disconnect on a live match",
    
version "0.0",
    
url "non"
}

public 
OnPluginStart()
{
    
MK_Enabled CreateConVar("sm_matchkick_enable""0""Enable this Plugin")
    
HookEvent"player_disconnect"PlayerDisconnect_EventEventHookMode_Pre)
    
}


public 
Action:PlayerDisconnect_Event(Handle:eventString:name[], bool:dontBroadcast)
{
    if(
GetConVarBool(MK_Enabled))
    {
        
decl String:reason[64]
        
decl String:username[64]
        
decl String:userId[32]
        
GetEventString(event"name"usernamesizeof(username))
        
GetEventString(event"userid"userIdsizeof(userId))
        
GetEventString(event"reason"reasonsizeof(reason))
        
        if(
StrContains(reason"Disconnect by user.") != -1)
        {
            
CreateTimer(180.0Timer_Rejoin_TIMER_REPEAT);
            
CPrintToChatAll("%s has disconnected, they have 180 seconds to rejoin before being banned.");
            if 
HookEvent("player_connect"Event_PlayerConnectEventHookMode_Pre); 
            return;
            
ServerCommand("sm_addban 30 %s \"You have been banned for leaving while match is live\""userId)
            
LogMessage("User %s has been banned for leaving while match is live: %s"usernamereason)
        }
    }
    return 
Plugin_Handled
    


Last edited by ShaneAJM; 09-24-2017 at 02:26.
ShaneAJM 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 14:59.


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