View Single Post
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 02-14-2011 , 20:44   Re: Plugin Request - Hidden SourceTV client
Reply With Quote #2

PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

public Plugin:myinfo = {
    
name "Hide SourceTV",
    
author "bl4nk",
    
description "Hides SourceTV from the scoreboard",
    
version "1.0.0",
    
url "http://forums.alliedmods.net/"
};

public 
OnMapStart() {
    new 
iIndex FindEntityByClassname(MaxClients+1"tf_player_manager");
    if (
iIndex == -1) {
        
SetFailState("Unable to find player manager entity");
    }
    
    
SDKHook(iIndexSDKHook_ThinkPostHook_OnThinkPost);
}

public 
Hook_OnThinkPost(iEnt) {
    static 
iConnectedOffset = -1;
    if (
iConnectedOffset == -1) {
        
iConnectedOffset FindSendPropInfo("CTFPlayerResource""m_bConnected");
    }
    
    new 
iConnected[35];
    
GetEntDataArray(iEntiConnectedOffsetiConnected35);
    
    for (new 
135i++) {
        if (
iConnected[i] && IsFakeClient(i)) {
            
iConnected[i] = 0;
        }
    }
    
    
SetEntDataArray(iEntiConnectedOffsetiConnected35);

For TF2, requires the SDK Hooks extension. This hides all fake clients (bots) on the scoreboard, so if you for whatever reason use bots, this will hide them as well.

For CSS:
Change "tf_player_manager" to "cs_player_manager", and "CTFPlayerResource" to "CCSPlayerResource".

Last edited by bl4nk; 02-14-2011 at 20:49. Reason: Added directions for use in CSS
bl4nk is offline