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_Event, EventHookMode_Pre)
}
public Action:PlayerDisconnect_Event(Handle:event, String:name[], bool:dontBroadcast)
{
if(GetConVarBool(MK_Enabled))
{
decl String:reason[64]
decl String:username[64]
decl String:userId[32]
GetEventString(event, "name", username, sizeof(username))
GetEventString(event, "userid", userId, sizeof(userId))
GetEventString(event, "reason", reason, sizeof(reason))
if(StrContains(reason, "Disconnect by user.") != -1)
{
CreateTimer(180.0, Timer_Rejoin, _, TIMER_REPEAT);
CPrintToChatAll("%s has disconnected, they have 180 seconds to rejoin before being banned.");
if HookEvent("player_connect", Event_PlayerConnect, EventHookMode_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", username, reason)
}
}
return Plugin_Handled
}