Thread: [Solved] CS:GO end round
View Single Post
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 09-23-2018 , 15:55   Re: CS:GO x Kills = end round
Reply With Quote #4

Quote:
Originally Posted by Vaggelis View Post
Untested, at CS_TerminateRound the 5.0 is the delay before new round starts and the CSRoundEnd_Draw is the reason (you can change it of course). Here all all the reasons: https://sm.alliedmods.net/new-api/cs...RoundEndReason
PHP Code:
#include <sourcemod>
#include <cstrike>

#define KILLS 3

new g_Kills[MAXPLAYERS 1]

public 
OnPluginStart()
{
    
HookEvent("round_start"Event_RoundStart)
    
HookEvent("player_death"Event_PlayerDeath)
}

public 
Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    for(new 
1<= MaxClientsi++)
    {
        if(
IsClientInGame(i))
        {
            
g_Kills[i] = 0
        
}
    }
}

public 
Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
victim GetClientOfUserId(GetEventInt(event"userid"))
    new 
attacker GetClientOfUserId(GetEventInt(event"attacker"))
    
    if(
attacker && IsClientInGame(attacker) && attacker != victim)
    {
        
g_Kills[attacker]++
        
        if(
g_Kills[attacker] >= KILLS)
        {
            
CS_TerminateRound(5.0CSRoundEnd_Draw)
        }
    }

@Vaggelis can you add also a PrintToChat with the message, Player <NAME> reached 3 Kills and ended the round
iskenderkebab33 is offline