Thread: helpz me blisz
View Single Post
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 05-15-2018 , 06:30   Re: helpz me blisz
Reply With Quote #3

Quote:
Originally Posted by LenHard View Post
PHP Code:
#include <sourcemod>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart()
{
    
HookEvent("player_team"Event_PlayerTeamEventHookMode_Post);
}

public 
void Event_PlayerTeam(Event hEventchar[] sEventNamebool bDontBroadcast)
{
    
int iTeam1 0iTeam2 0;
    
    for (
int i 0<= MaxClients; ++i)
    {
        if (
IsClientInGame(i))
        {
            switch (
GetClientTeam(i))
            {
                case 
2: ++iTeam1// Terrorist or Red Team 
                
case 3: ++iTeam2// Counter-Terrorist or Blue Team
            
}
        }
    }
    
    if (
iTeam1 == && iTeam2 == 5)
    {
        
// Knife Code...
    
}

I'm assuming this is what you want? It could be done multiple ways, this is one of them.
Rather than using all that code above to get the client count in each team, why not just do the following with GetTeamClientCount()?

PHP Code:
#include <sourcemod>
#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart()
{
    
HookEvent("player_team"Event_PlayerTeamEventHookMode_Post);
}

public 
void Event_PlayerTeam(Event event, const char[] namebool dontBroadcast
{
    
int iTeam1 2;
    
int iTeam2 3;
    if (
GetTeamClientCount(iTeam1) >= 10 && GetTeamClientCount(iTeam2) >= 10)
    {
        
// Lemme shank ya! :O
    
}

Also, I think this should be moved to the Scripting board.
__________________

Last edited by Psyk0tik; 05-15-2018 at 19:06.
Psyk0tik is offline