Thread Rating:
  • 3 Vote(s) - 3.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Release HUD Toggler
#1
Wink 
Hey guys,

i made new plugin, which switches hud on !hud command without 0 or 1.

Source code:
Code:
using Addon;
using System.Collections.Generic;

namespace plugin_test
{
    public class plugin_test : CPlugin
    {
        public bool hud_enabled = true;
        public override void OnServerLoad()
        {
            ServerPrint("\n Hud Switcher plugin loaded. \n Creator: x7'se7en");
        }

        public override ChatType OnSay(string Message, ServerClient Client)
        {
            if (Message.StartsWith("!hud"))
            {
                if (hud_enabled)
                {
                    SetClientDvar(Client.ClientNum, "g_hardcore \"0\"");
                    TellClient(Client.ClientNum, "^3HUD Disabled.", true);
                    disable2();
                }
                else
                {
                    SetClientDvar(Client.ClientNum, "g_hardcore \"1\"");
                    TellClient(Client.ClientNum, "^3HUD Enabled.", true);
                    enable2();
                }

            }
            return ChatType.ChatContinue;
        }

        public void disable2()
        {
            hud_enabled = false;
        }
        public void enable2()
        {
            hud_enabled = true;
        }

    }
}

Someone test it.

Download:

.rar   hudpluh.rar (Size: 1.94 KB / Downloads: 109)
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#2
......................
crAyon makes no warranty with respect to documents or other information available from this place, assumes no legal liability or responsibility whatsoever for the accuracy, completeness, or usefulness of any such information, and does not represent that its use would not infringe privately owned rights. crAyon disclaims all warranties, express and implied, including the warranties of merchantability and fitness for a particular purpose.
Reply

#3
That's not going to work. See you are setting a global variable (variable for everyone) for a client. That means when someone disables hud, the plugin means everyone disabled hud. You need to do it someway different where you for example a Dictionary with client xuid and hud bool.

But good idea. [Image: in.gif] <-- @SuperNovaAO add that smiley
[Image: azuw.jpg]
Reply

#4
(02-03-2012, 20:15)zxz0O0 Wrote: That's not going to work. See you are setting a global variable (variable for everyone) for a client. That means when someone disables hud, the plugin means everyone disabled hud. You need to do it someway different where you for example a Dictionary with client xuid and hud bool.

But good idea. [Image: in.gif] <-- @SuperNova add that smiley

It was close enough actually. The client dvar that enables / disables the hud is "ui_hud_hardcore".

[Image: MaEIQ.png]
Reply

#5
doesn't work...
Reply

#6
(02-29-2012, 02:31)pollarpart Wrote: doesn't work...

You can help the TS by being more specific.
Reply

#7
(02-29-2012, 16:24)surtek Wrote:
(02-29-2012, 02:31)pollarpart Wrote: doesn't work...

You can help the TS by being more specific.

There is nothing to be specific about. It just doesn't work. The hud doesn't get disabled because se7en used the wrong dvar.
[Image: MaEIQ.png]
Reply

#8
(02-29-2012, 16:25)Pozzuh Wrote:
(02-29-2012, 16:24)surtek Wrote:
(02-29-2012, 02:31)pollarpart Wrote: doesn't work...

You can help the TS by being more specific.

There is nothing to be specific about. It just doesn't work. The hud doesn't get disabled because se7en used the wrong dvar.
Pozzuh, fix please? Big Grin

PLEASE POZZUH lol
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Release] Simple 3rd person toggler Yamato 1 1,757 12-30-2011, 17:53
Last Post: GscGunner

Forum Jump:


Users browsing this thread:
2 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.