Raised This Month: $32 Target: $400
 8% 

Hidden SourceTV


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Remas
Junior Member
Join Date: May 2013
Location: United Kingdom
Old 08-30-2013 , 14:37   Hidden SourceTV
Reply With Quote #1

Hello there. Recently I've been messing around, trying to get my STV to hide completely both from the scoreboard and status in the console. This is the code I've managed to pull together and edit a bit but it doesn't really do the job when it comes to hiding STV from the status command.

PHP Code:
#pragma semicolon 1

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

public Plugin:myinfo =
{
    
name "Hide SourceTV"
};

new 
Handle:g_hHostname INVALID_HANDLE;

public 
OnPluginStart()
{
    
g_hHostname FindConVar("hostname");
}

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

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



    
    
bool:ValidPlayer(i)
{
    if(
i>&& i<=MaxClients && IsClientConnected(i) && IsClientInGame(i))
    {
        return 
true;
    }
    return 
false;
}    


FormatShortTime(timeString:outTime[],size)
{
    new 
temp;
    
temp time%60;
    
Format(outTime,size,"%02d",temp);
    
temp = (time%3600)/60;
    
Format(outTime,size,"%02d:%s",temp,outTime);
    
temp = (time%86400)/3600;
    if(
temp>0)
    {
        
Format(outTime,size,"%d%:s",temp,outTime);

    }
}


    
public 
Action:Command_Status(client, const String:command[], args)
{
    new 
String:buffer[64];
    
GetConVarString(g_hHostname,buffer,sizeof(buffer));
    
PrintToConsole(client,"hostname: %s",buffer);
    
PrintToConsole(client,"version : 1.0.0.73/22 5028 secure");
    
GetCurrentMap(buffer,sizeof(buffer));
    
PrintToConsole(client,"map     : %s at: 0 x, 0 y, 0 z",buffer);
    
PrintToConsole(client,"# userid name                 uniqueid            connected ping loss state");
    new 
String:name[18];
    new 
String:steamID[19];
    new 
String:time[9];
    for(new 
i<= MaxClientsi++)
    {

    
    
        if(
IsClientSourceTV(i))
        {
            
PrintToChatAll("Test");
        }
        else
        {
            
Format(name,sizeof(name),"\"%N\"",i);
            
GetClientAuthString(i,steamID,sizeof(steamID));
            if(
ValidPlayer(i))
            {
                
FormatShortTime(RoundToFloor(GetClientTime(i)),time,sizeof(time));
                
PrintToConsole(client,"# %6d %-19s %19s %9s %4d %4d active",GetClientUserId(i),name,steamID,time,RoundToFloor(GetClientAvgLatency(i,NetFlow_Both) * 1000.0),RoundToFloor(GetClientAvgLoss(i,NetFlow_Both)*100.0));
            } 
            else 
            {
                
PrintToChatAll("Test2");
            }
        }
    }
    return 
Plugin_Stop;

If anyone could help then we would greatly appreciate it.

Edit:

Here is the code i used to edit the Status command. I took it from Admin Stealth plugin by necavi

PHP Code:
public Action:Command_Status(client, const String:command[], args)
{
    new 
String:buffer[64];
    
GetConVarString(g_hHostname,buffer,sizeof(buffer));
    
PrintToConsole(client,"hostname: %s",buffer);
    
PrintToConsole(client,"version : 1.0.0.73/22 5028 secure");
    
GetCurrentMap(buffer,sizeof(buffer));
    
PrintToConsole(client,"map     : %s at: 0 x, 0 y, 0 z",buffer);
    if(
CheckCommandAccess(client,"sm_stealth",0))
    {
        
PrintToConsole(client,"players : %d (%d max)",GetClientCount(),MaxClients);
    } else {
        
PrintToConsole(client,"players : %d (%d max)",GetClientCount() - GetInvisCount(),MaxClients);
    }
    
PrintToConsole(client,"# userid name                uniqueid            connected ping loss state");
    new 
String:name[18];
    new 
String:steamID[19];
    new 
String:time[9];
    for(new 
i<= MaxClientsi++)
    {
        if(
ValidPlayer(i))
        {
            if(
CheckCommandAccess(client,"sm_stealth",0) || !g_bIsInvisible[i])
            {
                
Format(name,sizeof(name),"\"%N\"",i);
                
GetClientAuthString(i,steamID,sizeof(steamID));
                if(!
IsFakeClient(i))
                {
                    
FormatShortTime(RoundToFloor(GetClientTime(i)),time,sizeof(time));
                    
PrintToConsole(client,"# %6d %-19s %19s %9s %4d %4d active",GetClientUserId(i),name,steamID,time,RoundToFloor(GetClientAvgLatency(i,NetFlow_Both) * 1000.0),RoundToFloor(GetClientAvgLoss(i,NetFlow_Both)*100.0));
                } else {
                    
PrintToConsole(client,"# %6d %-19s %19s                     active",GetClientUserId(i),name,steamID);
                }
            }
        }
    }
    return 
Plugin_Stop;

__________________
Best Regards.
Remas

Last edited by Remas; 08-30-2013 at 15:02. Reason: Adding Info
Remas is offline
MasterOfTheXP
Veteran Member
Join Date: Aug 2011
Location: Cloudbank
Old 08-30-2013 , 16:11   Re: Hidden SourceTV
Reply With Quote #2

That fake status command is somewhat of a mess, in my opinion. Admin Stealth doesn't count connecting (but not in-game) clients like how the vanilla status command does, but SourceMod doesn't seem to be able to check things like latency on clients who aren't in-game yet. I wouldn't bother with that; it's most likely that no one's even going to notice it there.

However, I myself have tried to hide SourceTV from the scoreboard (because always having 1 spectator bot looks a bit...bad, I guess) but changing its m_iTeamNum just seems to screw up the demos that it records; target IDs weren't visible on any players in the demo that I test-recorded. So I'm not exactly sure about the scoreboard part.
__________________
Plugins / My Steam / TF2 Sandbox (plugin beta testing!)
MasterOfTheXP is offline
Remas
Junior Member
Join Date: May 2013
Location: United Kingdom
Old 08-30-2013 , 16:17   Re: Hidden SourceTV
Reply With Quote #3

The scoreboard part works perfectly and the demos are recording fine as well (at least they did). Its just the status part that doesn't work. Players on my server can be quite sneaky and most of them use the status command. If that wasn't the case i certainly would not be bothering with it

I am not a great programmer in fact - i'm not a programmer at all. Me and my friend were messing around with this since he does a bit of programming but we couldn't get it to work.
__________________
Best Regards.
Remas
Remas is offline
Doodil
Senior Member
Join Date: Mar 2012
Old 08-30-2013 , 16:22   Re: Hidden SourceTV
Reply With Quote #4

and what part is not working? Does it still show the old status message? Does it show the new one but still include the sourcetv bot?
Doodil is offline
Remas
Junior Member
Join Date: May 2013
Location: United Kingdom
Old 08-30-2013 , 16:24   Re: Hidden SourceTV
Reply With Quote #5

It does show the new one but still includes the sourcetv bot. I've been checking if it does by changing whats in PrintToConsole
__________________
Best Regards.
Remas
Remas is offline
Doodil
Senior Member
Join Date: Mar 2012
Old 08-30-2013 , 16:29   Re: Hidden SourceTV
Reply With Quote #6

That means the "IsClientSourceTV" function seems to be not working. As a workaround you can change the name of the sourcetv-bot to something noone else will call themself and check if clientname equals the sourcetvbotname and skip him if so
Doodil is offline
Remas
Junior Member
Join Date: May 2013
Location: United Kingdom
Old 08-30-2013 , 16:35   Re: Hidden SourceTV
Reply With Quote #7

it will still show up as a BOT though
__________________
Best Regards.
Remas
Remas is offline
Remas
Junior Member
Join Date: May 2013
Location: United Kingdom
Old 08-30-2013 , 16:36   Re: Hidden SourceTV
Reply With Quote #8

I would say that whatever me and my friend did is probably wrong and this can be done but it has to be coded a bit differently
__________________
Best Regards.
Remas
Remas is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 08-30-2013 , 18:20   Re: Hidden SourceTV
Reply With Quote #9

@Remas

Instead of spamming new comments every minute, sit back and think about what you want to say and combine it in one. If you forget to mention something then use the Edit button at the top-right of each post.
__________________
11530 is offline
Remas
Junior Member
Join Date: May 2013
Location: United Kingdom
Old 08-30-2013 , 18:39   Re: Hidden SourceTV
Reply With Quote #10

I've said everything that I wanted to say and then I was answering other people. Is that considered spamming? (not counting these last two posts which i could have made into one)
__________________
Best Regards.
Remas
Remas 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 09:02.


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