Raised This Month: $32 Target: $400
 8% 

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 , 20: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 20:32.
AlexLopesAltero is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 07-12-2020 , 21: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 21:10.
Supremache is offline
chickez
Junior Member
Join Date: Jun 2020
Location: Slovakia
Old 07-13-2020 , 03: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 , 06: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 , 07: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 07:40.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
chickez
Junior Member
Join Date: Jun 2020
Location: Slovakia
Old 07-13-2020 , 08:27   Re: Disable Huds From Plugins
Reply With Quote #6

Oh, I see.
Thank you for explanation.
chickez is offline
Reply



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 19:00.


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