Raised This Month: $ Target: $400
 0% 

[CS:GO] Spectator List


Post New Thread Reply   
 
Thread Tools Display Modes
clarkeylogic
Member
Join Date: Jun 2015
Old 07-29-2015 , 20:12   Re: [CS:GO] Spectator List
Reply With Quote #21

Quote:
Originally Posted by Miu View Post
the else block isn't connected to that condition, you even have a comment telling you that
Wow that is embarrassing ^^ I guess I looked for something more complicated the whole time. Sorry for wasting your time
clarkeylogic is offline
'-_-'<3zok<3'-_-'
Senior Member
Join Date: Feb 2010
Location: Norway
Old 12-07-2015 , 15:29   Re: [CS:GO] Spectator List
Reply With Quote #22

Not trying to bump or anything but making a new tread on this subject is just being a rudeboy, I've tried making a version of this without the showkey function because its allready in the mod I'm using on the server, it will probably interfer with it and optimizing is very important for me even if it could just be disabled, complies without any errors but doesnt print anything ingame, what did I do wrong?


PHP Code:
#pragma semicolon 1
 
#define DEBUG
 
#define PLUGIN_AUTHOR "Clarkey"
#define PLUGIN_VERSION "1.0"
 
#include <sourcemod>
#include <sdktools>
 
#pragma newdecls required
 
#define SPECMODE_NONE            0
#define SPECMODE_FIRSTPERSON    4
#define SPECMODE_3RDPERSON        5
#define SPECMODE_FREELOOK        6
 
Handle g_SpecList INVALID_HANDLE;
bool g_SpecListShow[MAXPLAYERS 1] = { true, ... };
 
public 
Plugin myinfo =
{
    
name "Spec Upgrade",
    
author PLUGIN_AUTHOR,
    
description "Upgrades the spectators experience.",
    
version PLUGIN_VERSION,
    
url "http://finalrespawn.com/"
};
 
public 
void OnPluginStart()
{
    
g_SpecList CreateTimer(3.0Timer_SpecList_TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
    
RegConsoleCmd("sm_speclist"Cmd_SpecList"Toggle showing spec list.");
}
 
public 
void OnPluginEnd()
{
    if (
g_SpecList != INVALID_HANDLE)
    {
        
KillTimer(g_SpecList);
        
g_SpecList INVALID_HANDLE;
    }
}
 
public 
void OnClientDisconnect(int client)
{
    
g_SpecListShow[client] = true;  
}
 
public 
Action Timer_SpecList(Handle timerany data)
{
    for (
int Client 1Client <= MaxClientsClient++)
    {
        if (!
IsClientInGame(Client) || !g_SpecListShow[Client])
            continue;
             
        if (
IsPlayerAlive(Client))
        {
            
//Create our panel the players see.
            
Panel panel = new Panel(null);
            
int SpecCount;
             
            for (
int i 1<= MaxClientsi++)
            {
                if (!
IsClientInGame(i) || !IsClientObserver(i))
                    continue;
                 
                
int SpecMode GetEntProp(iProp_Send"m_iObserverMode");
                 
                
// The client isn't spectating any one person, so ignore them.
                
if (SpecMode != SPECMODE_FIRSTPERSON && SpecMode != SPECMODE_3RDPERSON)
                    continue;
                     
                
//See who the client is spectating.
                
int Target GetEntPropEnt(iProp_Send"m_hObserverTarget");
                 
                if (
Target == Client)
                {
                    
char ClientName[32];
                    
GetClientName(iClientName32);
                    
panel.DrawText(ClientName);
                    
SpecCount++;
                }
            }
             
            
char PanelTitle[16];
            
Format(PanelTitlesizeof(PanelTitle), "Spec: %i"SpecCount);
             
            if (
SpecCount != 0)
            {
                
panel.SetTitle(PanelTitle);
                
panel.Send (ClientPanel_Spec3);
            }
        }
    }
    return 
Plugin_Continue;
}
 
public 
int Panel_Spec(Menu menuMenuAction actionint param1int param2)
{
    if (
action == MenuAction_Select)
    {
        return;
    }
    else if (
action == MenuAction_End)
    {
        
delete menu;
    }
}
 
 
public 
Action Cmd_SpecList(int clientint args)
{
    if (
g_SpecListShow[client])
    {
        
g_SpecListShow[client] = false;
        
PrintToChat(client"[Final Respawn] Spec List has been disabled.");
        return 
Plugin_Continue;
    }
    else
    {
        
g_SpecListShow[client] = true;
        
PrintToChat(client"[Final Respawn] Spec List has been enabled.");
        return 
Plugin_Continue;
    }

'-_-'<3zok<3'-_-' is offline
Send a message via Skype™ to '-_-'<3zok<3'-_-'
lingzhidiyu
Senior Member
Join Date: Mar 2014
Old 12-08-2015 , 10:29   Re: [CS:GO] Spectator List
Reply With Quote #23

PHP Code:
                // If client is not spec someone m_hObserverTarget will return -1?
                
if (SpecMode != SPECMODE_FIRSTPERSON && SpecMode != SPECMODE_3RDPERSON)
                    continue;
                
// Close it when finish send, or memory leak?
                
delete panel
PHP Code:
#pragma semicolon 1
 
#define DEBUG
 
#define PLUGIN_AUTHOR "Clarkey"
#define PLUGIN_VERSION "1.0"
 
#include <sourcemod>
#include <sdktools>
 
#pragma newdecls required
 
bool g_SpecListShow[MAXPLAYERS 1] = { true, ... };

public 
Plugin myinfo =
{
    
name "Spec Upgrade",
    
author PLUGIN_AUTHOR,
    
description "Upgrades the spectators experience.",
    
version PLUGIN_VERSION,
    
url "http://finalrespawn.com/"
};
 
public 
void OnPluginStart()
{
    
CreateTimer(3.0Timer_SpecList_TIMER_REPEAT);
    
RegConsoleCmd("sm_speclist"Cmd_SpecList"Toggle showing spec list.");
}
 
public 
void OnClientDisconnect(int client)
{
    
g_SpecListShow[client] = true;  
}
 
public 
Action Timer_SpecList(Handle timer)
{
    
ArrayList hSpecListArray = new ArrayList(1);

    for (
int Client 1Client <= MaxClientsClient++)
    {
        if (!
IsClientInGame(Client)) continue;
        if (!
g_SpecListShow[Client]) continue;
        if (!
IsPlayerAlive(Client)) continue;

        
hSpecListArray.Clear();

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

            
int Target GetEntPropEnt(iProp_Send"m_hObserverTarget");
             
            if (
Target != Client)
            {
                
hSpecListArray.Push(Target);
            }
        }

        
PrintToServer("%d"hSpecListArray.Length);
         
        if (
hSpecListArray.Length 0)
        {
            
Panel panel = new Panel(null);

            
char PanelTitle[16];
            
Format(PanelTitlesizeof(PanelTitle), "Spec: %i"hSpecListArray.Length);
            for (
int x 0hSpecListArray.Lengthx++)
            {
                
char ClientName[32];
                
GetClientName(hSpecListArray.Get(x), ClientName32);
                
panel.DrawText(ClientName);
            }

            
panel.SetTitle(PanelTitle);
            
panel.Send(ClientPanel_Spec3);

            
delete panel;
        }
    }

    
delete hSpecListArray;
}
 
public 
int Panel_Spec(Menu menuMenuAction actionint param1int param2) {}
 
public 
Action Cmd_SpecList(int clientint args)
{
    
g_SpecListShow[client] = !g_SpecListShow[client];

    if (
g_SpecListShow[client])
    {
        
PrintToChat(client"[Final Respawn] Spec List has been enabled.");
    } 
    else 
    {
        
PrintToChat(client"[Final Respawn] Spec List has been disabled.");
    }


Last edited by lingzhidiyu; 12-08-2015 at 10:29.
lingzhidiyu is offline
hu3br
Senior Member
Join Date: Apr 2015
Old 03-11-2016 , 10:03   Re: [CS:GO] Spectator List
Reply With Quote #24

Why this dont works for me ?
hu3br 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 13:55.


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