View Single Post
Author Message
Charles_
Junior Member
Join Date: Jul 2015
Location: Connecticut, USA
Old 07-07-2018 , 18:34   CS:GO How to check if client has panorama UI enabled
Reply With Quote #1

I figured I would share this code as it may be helpful to others. It essentially allows you to detect if a client is running the new panorama UI or the old scale form UI.

DISCLAIMER: This may not be the best method to do this, but it works. The ability to essentially opt in and out of the new UI changes is temporary and won't be around for very long, so this should solve the problem for the time being.

Also, just in case you don't yet know how to enable the panorama UI, you can do so by adding -panorama to your launch options.

I personally made this for use in a bhop timer so that I would able to assure that both sets of players saw functional Hint HUD, for whichever UI they chose, without glitches.

I decided to work this out since valve removed all HTML elements, except font color, along with the ability to create tabs, from the panorama Hint HUD. Thus essentially turning it into the Counter-Strike: Source Hint HUD, but with font colors.

To use this, you can simply follow these steps:
  1. Create the following bool with the rest of your plugin variables.
    PHP Code:
    bool g_bIsPanorama[MAXPLAYERS 1]; 
  2. Then, add this code somewhere to your plugin, and if needed add the contents of ClientConVar and OnClientPostAdminCheck to your existing ClientConVar and OnClientPostAdminCheck. You may need to remove the returns and/or slightly modify this further depending on what you do with ClientConVar if you already use it.
    PHP Code:
    void PanoramaCheck(int client)
    {
        
    g_bIsPanorama[client] = false;
        
    QueryClientConVar(client"@panorama_debug_overlay_opacity"ClientConVar);
    }

    public 
    void ClientConVar(QueryCookie cookieint clientConVarQueryResult result, const char[] cvarName, const char[] cvarValue)
    {
        if (
    result != ConVarQuery_Okay) {
            
    g_bIsPanorama[client] = false;
            return;
        }
        else
        {
            
    g_bIsPanorama[client] = true;
            return;
        }
    }

    public 
    void OnClientPostAdminCheck(int client)
    {
        
    PanoramaCheck(client);

  3. Lastly, wrap any code that only works for a certain UI in an if statement that checks the value of g_bIsPanorama[client]. If this value is true, they use the new panorama UI. Otherwise, if the value is false, they are still using the old scale form UI.

    For example:
    PHP Code:
    if(g_bIsPanorama[client] == true)
    {
        
    //client runs the new panorama UI
    }
    else
    {
        
    //client runs the old scale form UI


If you have any questions about this or need assistance with converting plugins for the new UI changes, feel free to reply here and when I have free time, I'll try to offer assistance based on what I've found during my own testing. Hope this helps.
Charles_ is offline