Raised This Month: $12 Target: $400
 3% 

[REQ] Closed Hud Message By the player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 03-20-2020 , 04:19   [REQ] Closed Hud Message By the player
Reply With Quote #1

I want a plugin that allows each player to disable their message

For example, this code is active for up to 40 seconds
PHP Code:
public plugin_init()
{
            
RegisterHam(Ham_Spawn"player""ads"1
}

public 
ads(id)
{
            
set_hudmessage(00255, -1.00.2906.040.0);
        
show_hudmessage(id"Welcom To Public Server^nAds: xxxx^nxxxxxx^nxxxxxx");

Ten seconds until it is deactivated, the player type (say /messagestop) and the message is closed
alferd is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 03-20-2020 , 07:40   Re: [REQ] Closed Hud Message By the player
Reply With Quote #2

I wrote by phone, that is, not tested and there may be errors.

PHP Code:
#include <amxmodx>

new bool:UserMsg[33]

new 
AdsCvarAdsHandler
public plugin_init()
{
    
register_clcmd("say /messagestop""MsgHandler")
    
AdsCvar register_cvar("ads_time""40")
}

public 
client_putinserver(id)
{
    if(!
is_user_bot(id))
    {
        
AdsHandler get_pcvar_num(AdsCvar)
        
UserMsg[id] = true
        CountDown
(id)
    }
}

public 
CountDown(id)
{
    if(!
UserMsg[id]) return 
    
    
AdsHandler --
    
    if(
AdsHandler 0)
    {
        
set_hudmessage(00255, -1.00.2906.040.0);
        
show_hudmessage(id"Welcom To Public Server^nAds: xxxx^nxxxxxx^nxxxxxx")
        
set_task(1.0"CountDown"id)
    }
    else
    {
        
remove_task(id)
    }
}

public 
MsgHandler(id)
{
    
UserMsg[id] = false
    
    client_print
(idprint_chat"You %s the ads."UserMsg[id] ? "enable" "disable")
    return 
PLUGIN_HANDLED

__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/

Last edited by iceeedr; 03-21-2020 at 17:09.
iceeedr is offline
Send a message via Skype™ to iceeedr
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 03-20-2020 , 07:48   Re: [REQ] Closed Hud Message By the player
Reply With Quote #3

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "WelcomeMsg"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"

#define MSGID 123479

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_clcmd("say /messagestop""DisableMessage");
    
register_clcmd("say /messagestart""EnableMessage");
}

public 
DisableMessage(id)
{
    if(
task_exists(id MSGID))
    {
        
remove_task(id MSGID);
    }
}

public 
EnableMessage(id)
{
    if(!
task_exists(id MSGID))
    {
        
set_task(40.0"ShowMessage"id MSGID__"b");
    }
}

public 
ShowMessage(id)
{
    
id -= MSGID;
    
set_hudmessage(00255, -1.00.2906.040.0);
    
show_hudmessage(id"Welcom To Public Server^nAds: xxxx^nxxxxxx^nxxxxxx"); 
}

public 
client_putinserver(id)
{
    
set_task(40.0"ShowMessage"id MSGID__"b");
}

public 
client_disconnect(id)
{
    if(
task_exists(id MSGID))
    {
        
remove_task(id MSGID)
    }

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 03-20-2020 , 12:14   Re: [REQ] Closed Hud Message By the player
Reply With Quote #4

Quote:
Originally Posted by Napoleon_be View Post
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "WelcomeMsg"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"

#define MSGID 123479

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_clcmd("say /messagestop""DisableMessage");
    
register_clcmd("say /messagestart""EnableMessage");
}

public 
DisableMessage(id)
{
    if(
task_exists(id MSGID))
    {
        
remove_task(id MSGID);
    }
}

public 
EnableMessage(id)
{
    if(!
task_exists(id MSGID))
    {
        
set_task(40.0"ShowMessage"id MSGID__"b");
    }
}

public 
ShowMessage(id)
{
    
id -= MSGID;
    
set_hudmessage(00255, -1.00.2906.040.0);
    
show_hudmessage(id"Welcom To Public Server^nAds: xxxx^nxxxxxx^nxxxxxx"); 
}

public 
client_putinserver(id)
{
    
set_task(40.0"ShowMessage"id MSGID__"b");
}

public 
client_disconnect(id)
{
    if(
task_exists(id MSGID))
    {
        
remove_task(id MSGID)
    }

this is good, But I type (say /messagestop) the message will not be disabled
Disables after the end of time
I want to disable it immediately when typing (say /messagestop)
alferd is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 03-20-2020 , 19:59   Re: [REQ] Closed Hud Message By the player
Reply With Quote #5

Quote:
Originally Posted by alferd View Post
this is good, But I type (say /messagestop) the message will not be disabled
Disables after the end of time
I want to disable it immediately when typing (say /messagestop)
Did you test my code?
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 03-21-2020 , 04:14   Re: [REQ] Closed Hud Message By the player
Reply With Quote #6

Quote:
Originally Posted by iceeedr View Post
Did you test my code?
I'm testing now
alferd is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 03-21-2020 , 04:34   Re: [REQ] Closed Hud Message By the player
Reply With Quote #7

Quote:
Originally Posted by iceeedr View Post
Did you test my code?
It didn't work, not even the message
alferd is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 03-21-2020 , 17:09   Re: [REQ] Closed Hud Message By the player
Reply With Quote #8

Quote:
Originally Posted by alferd View Post
It didn't work, not even the message
Code revised and working now, please test.
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 03-22-2020 , 04:38   Re: [REQ] Closed Hud Message By the player
Reply With Quote #9

Quote:
Originally Posted by iceeedr View Post
Code revised and working now, please test.
It still didn't work,not even the message
alferd is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 03-22-2020 , 04:40   Re: [REQ] Closed Hud Message By the player
Reply With Quote #10

Quote:
Originally Posted by iceeedr View Post
Code revised and working now, please test.
It still didn't work,not even the message,
alferd 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 22:34.


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