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

Kick/Ban Hook


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AuricYoutube
Senior Member
Join Date: Aug 2016
Location: Here
Old 07-02-2022 , 04:35   Kick/Ban Hook
Reply With Quote #1

Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <cstrike>

public OnPluginStart()
{
    HookEvent("player_death", Event_PlayerDeath);
    HookEvent("client_disconnect", Event_PlayerDeath);
    HookEvent("player_team", Event_PlayerDeath);
}

public Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (AllHumansDead())
    {
        CS_TerminateRound(GetConVarFloat(FindConVar("mp_round_restart_delay")), CSRoundEnd_TerroristWin);
    }
}

bool:AllHumansDead()
{
    new bool:result = true;
    
    for (new i = 1; i <= MaxClients; i++)
    {
        if (IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == CS_TEAM_CT) 
        {
            result = false;
        }
    }
    
    return result;
}
This plugin works when a player leaves, dies, changes team but it does not work when I kick the remaining alive player or if they get banned (not ending the round), how would I hook that?
AuricYoutube is offline
Cruze
Veteran Member
Join Date: May 2017
Old 07-02-2022 , 10:22   Re: Kick/Ban Hook
Reply With Quote #2

try player_disconnect instead of client_disconnect
__________________
Taking paid private requests! Contact me
Cruze is offline
Reply


Thread Tools
Display Modes

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 18:19.


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