Created
November 13, 2019 02:57
-
-
Save shanapu/bd9fecaf59272b644e870f6ff18e3355 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstrike> | |
#include <sourcemod> | |
#include <warmod> | |
/* Handles to convars used by plugin */ | |
ConVar sm_matchkick_bantime; | |
ConVar sm_matchkick_minplayer; | |
public Plugin:myinfo = { | |
name = "Matchkick for warmod", | |
author = "paul181516,shanapu", | |
description = "Bans a player who is disconnected on a live match", | |
version = "1.1", | |
url = "" | |
} | |
bool g_bIsLive = false; | |
public OnPluginStart() | |
{ | |
sm_matchkick_bantime = CreateConVar("sm_matchkick_bantime", "360", "Duracion del baneo por abandonar el PUG."); | |
sm_matchkick_minplayer = CreateConVar("sm_matchkick_minplayer", "7", "Jugadores necesarios para iniciar el plugin."); | |
HookEvent("player_disconnect", Event_PlayerDisconnect, EventHookMode_Post); | |
} | |
public void OnLiveOn3() | |
{ | |
g_bIsLive = true; | |
} | |
public void OnResetMatch() | |
{ | |
g_bIsLive = false; | |
} | |
public void OnEndMatch(const char[] ct_name, int ct_score, int t_score, const char[] t_name) | |
{ | |
g_bIsLive = false; | |
} | |
public Event_PlayerDisconnect(Handle:event, String:name[], bool:dontBroadcast) | |
{ | |
if(g_bIsLive) | |
{ | |
if (GetClientCount(true) >= GetConVarInt(sm_matchkick_minplayer)) | |
{ | |
new client = GetClientOfUserId(GetEventInt(event, "userid")); | |
if(GetUserAdmin(client) == INVALID_ADMIN_ID) | |
{ | |
decl String:reason[128]; | |
GetEventString(event, "reason", reason, sizeof(reason)); | |
if (StrEqual(reason, "Disconnect")) | |
{ | |
BanClient(client, GetConVarInt(sm_matchkick_bantime), BANFLAG_AUTHID, "Fue baneado por salirse en medio de un PUG!", "Fuiste baneado por salirte en medio de un PUG! ¿Donde esta tu honor, basura?"); | |
LogMessage("%L fue baneado por salirse en medio de un PUG", client); | |
PrintToChatAll("%N fue baneado por salirse en medio de un PUG", client); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment