Raised This Month: $7 Target: $400
 1% 

CS:GO How to check if client has panorama UI enabled


Post New Thread Reply   
 
Thread Tools Display Modes
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
B3none
AlliedModders Donor
Join Date: Oct 2016
Location: United Kingdom
Old 07-21-2018 , 19:41   Re: CS:GO How to check if client has panorama UI enabled
Reply With Quote #2

I'll implement it and let you know, thanks!
__________________
B3none is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 07-22-2018 , 07:56   Re: CS:GO How to check if client has panorama UI enabled
Reply With Quote #3

I think query is possible on onclientauthorized.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
B3none
AlliedModders Donor
Join Date: Oct 2016
Location: United Kingdom
Old 07-22-2018 , 16:56   Re: CS:GO How to check if client has panorama UI enabled
Reply With Quote #4

Shorter way to write this:

PHP Code:
public void ClientConVar(QueryCookie cookieint clientConVarQueryResult result, const char[] cvarName, const char[] cvarValue)
{
    
b_IsPanorama[client] = (result == ConVarQuery_Okay);

__________________
B3none is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 08-03-2018 , 17:46   Re: CS:GO How to check if client has panorama UI enabled
Reply With Quote #5

This is useless now since panorama is enabled by default :p
mug1wara is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 08-03-2018 , 18:44   Re: CS:GO How to check if client has panorama UI enabled
Reply With Quote #6

Quote:
Originally Posted by mug1wara View Post
This is useless now since panorama is enabled by default :p
Default does not equal always though.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Addicted.
AlliedModders Donor
Join Date: Dec 2013
Location: 0xA9D0DC
Old 08-03-2018 , 23:41   Re: CS:GO How to check if client has panorama UI enabled
Reply With Quote #7

Quote:
Originally Posted by mug1wara View Post
This is useless now since panorama is enabled by default :p
You can still opt to use the old ui
Addicted. is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 08-04-2018 , 19:23   Re: CS:GO How to check if client has panorama UI enabled
Reply With Quote #8

Quote:
Originally Posted by Addicted. View Post
You can still opt to use the old ui
Didn't know lol? Ignore me then :p
mug1wara is offline
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 08-04-2018 , 21:54   Re: CS:GO How to check if client has panorama UI enabled
Reply With Quote #9

Quote:
Originally Posted by mug1wara View Post
Didn't know lol? Ignore me then :p
– For a limited transition time users can opt into backwards compatibility mode by adding -scaleform launch option. Release Notes for 8/2/2018
iskenderkebab33 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 05:13.


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