AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   CS:GO How to check if client has panorama UI enabled (https://forums.alliedmods.net/showthread.php?t=308902)

Charles_ 07-07-2018 18:34

CS:GO How to check if client has panorama UI enabled
 
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. :wink:

B3none 07-21-2018 19:41

Re: CS:GO How to check if client has panorama UI enabled
 
I'll implement it and let you know, thanks!

eyal282 07-22-2018 07:56

Re: CS:GO How to check if client has panorama UI enabled
 
I think query is possible on onclientauthorized.

B3none 07-22-2018 16:56

Re: CS:GO How to check if client has panorama UI enabled
 
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);



mug1wara 08-03-2018 17:46

Re: CS:GO How to check if client has panorama UI enabled
 
This is useless now since panorama is enabled by default :p

eyal282 08-03-2018 18:44

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

Originally Posted by mug1wara (Post 2607984)
This is useless now since panorama is enabled by default :p

Default does not equal always though.

Addicted. 08-03-2018 23:41

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

Originally Posted by mug1wara (Post 2607984)
This is useless now since panorama is enabled by default :p

You can still opt to use the old ui

mug1wara 08-04-2018 19:23

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

Originally Posted by Addicted. (Post 2608025)
You can still opt to use the old ui

Didn't know lol? Ignore me then :p

iskenderkebab33 08-04-2018 21:54

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

Originally Posted by mug1wara (Post 2608177)
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


All times are GMT -4. The time now is 15:57.

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