Raised This Month: $10 Target: $400
 2% 

Disable Huds From Plugins


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AlexLopesAltero
New Member
Join Date: Jul 2020
Old 07-12-2020 , 21:28   Disable Huds From Plugins
Reply With Quote #1

Hello guys ... I am finding a script in which the player can disable the plugins huds on the screen by command ... I really need this help


Last edited by AlexLopesAltero; 07-12-2020 at 21:32.
AlexLopesAltero is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 07-12-2020 , 22:09   Re: Disable Huds From Plugins
Reply With Quote #2

Quote:
Originally Posted by AlexLopesAltero View Post
Hello guys ... I am finding a script in which the player can disable the plugins huds on the screen by command ... I really need this help

PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < fun >


// Booleans
new g_bToggleHud33 ] = true;    

public 
plugin_init() {
    
register_pluginPLUGINVERSIONAUTHOR );

    
// Register Client Commands
    
register_clcmd"say /hud""cmdToggleHud" ); //Showing Hud Message On / Off
}



public 
client_putinserverid ) {
    
g_bToggleHudid ] = true;
    
set_task0.9"ShowHud"id__"b" );
}

    
// Toggle Showing Hud Message On / Off
public cmdToggleHudid ) {
    
g_bToggleHudid ] = !g_bToggleHudid ];
    return 
PLUGIN_HANDLED;
}

// Shows The Rank Information Message
public ShowHudid ) {
    if( 
g_bToggleHudid ] ) {
        
set_hudmessage(025500.010.1806.01.00.00.0, -);
        
show_hudmessage(id"Hud Message Enable/Disable" );
    }


Last edited by Supremache; 07-12-2020 at 22:10.
Supremache is offline
chickez
Junior Member
Join Date: Jun 2020
Location: Slovakia
Old 07-13-2020 , 04:49   Re: Disable Huds From Plugins
Reply With Quote #3

PHP Code:
// Toggle Showing Hud Message On / Off
public cmdToggleHudid ) {
    
g_bToggleHudid ] = !g_bToggleHudid ];
    return 
PLUGIN_HANDLED;

It will set bool to false one time. When player want back to turn on HUD, he must reconnect ( set bool to true ). I'm right?

I haven't test script but, why not like this?:
PHP Code:
// Toggle Showing Hud Message On / Off
public cmdToggleHudid )
{
    if ( 
g_bToggleHudid ] )
        
g_bToggleHudid ] = false;
    else
        
g_bToggleHudid ] = true;
    return 
PLUGIN_HANDLED;

I'm just asking, if I'm right.

I have hud on/off in my plugin coded like I post, and it's working for me.
chickez is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 07-13-2020 , 07:31   Re: Disable Huds From Plugins
Reply With Quote #4

Quote:
Originally Posted by chickez View Post
PHP Code:
// Toggle Showing Hud Message On / Off
public cmdToggleHudid ) {
    
g_bToggleHudid ] = !g_bToggleHudid ];
    return 
PLUGIN_HANDLED;

It will set bool to false one time. When player want back to turn on HUD, he must reconnect ( set bool to true ). I'm right?

I haven't test script but, why not like this?:
PHP Code:
// Toggle Showing Hud Message On / Off
public cmdToggleHudid )
{
    if ( 
g_bToggleHudid ] )
        
g_bToggleHudid ] = false;
    else
        
g_bToggleHudid ] = true;
    return 
PLUGIN_HANDLED;

I'm just asking, if I'm right.

I have hud on/off in my plugin coded like I post, and it's working for me.

No, he can do it automatically so if he said /hud, hudessage will disable automatic and if said /hud again will enable the hud message
Supremache is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-13-2020 , 08:39   Re: Disable Huds From Plugins
Reply With Quote #5

Quote:
I haven't test script but, why not like this?
Why 4 lines of code with if-statements instead of 1 line of code without any if-statements? The result is the same.

PS: if you don't remove the task on disconnect, you're gonna end up with tons of overlapping messages.
PS2: use ShowSyncHudMsg.

Last edited by OciXCrom; 07-13-2020 at 08:40.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
chickez
Junior Member
Join Date: Jun 2020
Location: Slovakia
Old 07-13-2020 , 09:27   Re: Disable Huds From Plugins
Reply With Quote #6

Oh, I see.
Thank you for explanation.
chickez 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:53.


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