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

How do I print the number of players in a chat?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alphaearth
Senior Member
Join Date: Feb 2018
Location: Turkey
Old 11-20-2018 , 21:56   How do I print the number of players in a chat?
Reply With Quote #1

how many players on which team can I print to chat?

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <retakes>
#include <cstrike>

#pragma semicolon 1
#pragma newdecls required

#define PLUGIN_AUTHOR "Czar, B3none"
#define PLUGIN_VERSION "1.4"

Handle cvar_showterrorists INVALID_HANDLE;
public 
Plugin myinfo =
{
    
name "Retake hud",
    
author PLUGIN_AUTHOR,
    
description "Bombsite Hud",
    
version PLUGIN_VERSION,
    
url "https://github.com/Czar-VG/RetakeSiteHud"
};

public 
void OnPluginStart()
{
    
cvar_showterrorists CreateConVar("sm_showterrorists""1");

    
AutoExecConfig(true"retakehud");
    
HookEvent("round_start"Event_OnRoundStart);
}
public 
void Event_OnRoundStart(Handle event, const char[] namebool dontBroadcast)
{
    
CreateTimer(1.0displayHud);
}

public 
Action displayHud(Handle timer)
{
    if (
IsWarmup())
    {
        return;
    }

    
char bombsite[8];
    
bombsite = (Retakes_GetCurrrentBombsite() == BombsiteA) ? "A" "B";

    
bool showTerrorists GetConVarBool(cvar_showterrorists);

    for (
int i 1<= MaxClientsi++)
    {
        
int clientTeam GetClientTeam(i);
        
        if (
IsValidClient(i))
        {

            if (
HasBomb(i))
            {
                
// We always want to show this one regardless
                
ShowHudText(i5"Bomba Kuruldu!");
            }
            else if (
clientTeam == CS_TEAM_CT || (clientTeam == CS_TEAM_T && showTerrorists))
            {
                
PrintCenterText(i"<font color='#008000'%s Bombsite: ----- %s ----- \n %d T vs %d CT</font>"clientTeam == CS_TEAM_T "Defend" "Retake"bombsite, ???, ???);
            }
        }
    }
}

stock bool IsValidClient(int client)
{
    return 
client 0
        
&& client <= MaxClients
        
&& IsClientConnected(client)
        && 
IsClientInGame(client)
        && !
IsFakeClient(client);
}

stock bool HasBomb(int client)
{
    return 
GetPlayerWeaponSlot(client4) != -1;
}

stock bool IsWarmup()
{
    return 
GameRules_GetProp("m_bWarmupPeriod") == 1;

__________________

Last edited by alphaearth; 11-20-2018 at 21:57.
alphaearth is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 11-21-2018 , 01:41   Re: How do I print the number of players in a chat?
Reply With Quote #2

PHP Code:
    int players_in_team[4];

    for(
int i 1<= MaxClientsi++)
    {
        if(!
IsClientInGame(i)) continue;

        
players_in_team[GetClientTeam(i)]++;
        
    }

    
PrintToServer("Team CT %i - Team T %i"players_in_team[3], players_in_team[2]); 
__________________
Do not Private Message @me
Bacardi is offline
Reply



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 11:59.


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