Raised This Month: $ Target: $400
 0% 

suppress the message "the game will restart in x second


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mercury
Member
Join Date: Jun 2004
Old 10-14-2004 , 08:02   suppress the message "the game will restart in x second
Reply With Quote #1

HOW? )

i do amx_csay LIVE! LIVE! LIVE!
then sv_restart 3

i see hud message "LIVE! LIVE! LIVE!" for a second (but i want more) and then standard message "the game will restart in 3 seconds."

but the only thing i want to see is hud, or just won't dissapearing when "the game will restart in x seconds." displays.
mercury is offline
Da Bishop
Senior Member
Join Date: Aug 2004
Location: Chester County PA
Old 10-14-2004 , 08:07  
Reply With Quote #2

I believe that function "will restart in x Seconds" is found in one of the stats plugins.
Da Bishop is offline
Send a message via MSN to Da Bishop
mercury
Member
Join Date: Jun 2004
Old 10-14-2004 , 08:32  
Reply With Quote #3

no, it's a server's message. you can turn off ALL ADDONS and enter in sever console: sv_restart 1

and you will see that message.
mercury is offline
DS
SourceMod Developer
Join Date: Sep 2004
Location: WI, USA
Old 10-14-2004 , 10:49  
Reply With Quote #4

If you want to block that message, you will need to use the engine module.

Here's how I'd do it:
Code:
#include <amxmodx> #include <engine> public plugin_init() {     register_message(get_user_msgid("TextMsg"), "hook_TextMsg") // Hook TextMsg message to function } public hook_TextMsg(msgid, msgdest, msgargs) {     new message[32]     get_msg_arg_string(2, message, 31) // Get text message         // If text message = "Game will restart in X seconds" then block the message     if (equal(message, "#Game_will_restart_in")         return PLUGIN_HANDLED // Blocks message         return PLUGIN_CONTINUE // Lets other TextMsg messages go through }

register_message basically lets you hook a function to any game messages. In this case the "game will restart in" is done by the TextMsg message. And then you can block it by returning PLUGIN_HANDLED or let a message continue by returning PLUGIN_CONTINUE. In this case I only block the TextMsg when the message is about the game restarting, otherwise it will display all other text messages such as Counter-Terrorists Win.
DS is offline
mercury
Member
Join Date: Jun 2004
Old 10-14-2004 , 13:49  
Reply With Quote #5

thank you very much)

i wrote my own plugin with hud instead of poor cs's standard messages)
mercury is offline
mercury
Member
Join Date: Jun 2004
Old 10-14-2004 , 14:45  
Reply With Quote #6

here it is.. but it crashes the server on map change.

Code:
#include <amxmodx> #include <amxmisc> #include <engine> public hook_TextMsg(msgid, msgdest, msgargs) {     new message[32]     get_msg_arg_string(2, message, 31) // Get text message           // If text message = "Game will restart in X seconds" then block the message     if (equal(message, "#Game_will_restart_in"))         return PLUGIN_HANDLED // Blocks message           return PLUGIN_CONTINUE // Lets other TextMsg messages go through } public drestart(param[])     set_cvar_string("sv_restart",param) public admin_rr(id, level, cid) {     if (!cmd_access(id, level, cid, 3))         return PLUGIN_HANDLED     new sdelay[4], stimes[4]     read_argv(1,stimes,3)     read_argv(2,sdelay,3)     new delay = str_to_num(sdelay)     new times = str_to_num(stimes)     for(new a = times;a > 0;--a)         set_task( float(delay * a) + 1.0 , "drestart", 0, sdelay, 4)     // console_print(id,"The Game will restart %d times with a %d sec. delay between restarts",times,delay)     set_hudmessage(245, 245,245, -1.0, 0.4, 0, 4.0, 20.0, 2.0, 2.0, 1)     show_hudmessage(0,"RESTART!")     set_hudmessage(245, 10,10, -1.0, 0.43, 0, 4.0, 20.0, 2.0, 2.0, 2)     show_hudmessage(0,"LIVE! LIVE! LIVE!")     set_hudmessage(245, 10,10, -1.0, 0.46, 0, 4.0, 20.0, 2.0, 2.0, 3)     show_hudmessage(0,"GOOD LUCK, HAVE FUN!")     return PLUGIN_HANDLED } public plugin_init() {     register_plugin("Admin RestartRound","1.0.0","mercury")     register_concmd("amx_restart","admin_rr",ADMIN_LEVEL_A,"<restart times> <delay>")     register_message(get_user_msgid("TextMsg"), "hook_TextMsg") // Hook TextMsg message to function     return PLUGIN_CONTINUE }
mercury is offline
DS
SourceMod Developer
Join Date: Sep 2004
Location: WI, USA
Old 10-14-2004 , 17:39  
Reply With Quote #7

Quote:
Originally Posted by mercury
here it is.. but it crashes the server on map change.
Hmm, really? What version of AMXX are you using? I'm using the latest nightly build of 0.20 and it works fine on map changes.
DS is offline
BAILOPAN
Join Date: Jan 2004
Old 10-14-2004 , 17:40  
Reply With Quote #8

0.16 register_message will crash the server on mapchange. Sorry
__________________
egg
BAILOPAN is offline
DS
SourceMod Developer
Join Date: Sep 2004
Location: WI, USA
Old 10-14-2004 , 18:01  
Reply With Quote #9

Thanks for info, Bailo.

Ok, well if that's case you can either update to 0.20 if you wish or you can try this:

Change:
Code:
register_message(get_user_msgid("TextMsg"), "hook_TextMsg") // Hook TextMsg message to function

To:
Code:
register_event("TextMsg", "event_RestartRound", "a", "2=#Game_will_restart_in")

Remove the entire function called hook_TextMsg and replace it with this:
Code:
public event_RestartRound() {     set_msg_block(get_user_msgid("TextMsg"), BLOCK_ONCE)         return PLUGIN_CONTINUE }

set_msg_block is another way to block messages. I'm just so used to using register_message that I rarely use it. But this should work in 0.16 AFAIK.
DS is offline
BAILOPAN
Join Date: Jan 2004
Old 10-14-2004 , 20:46  
Reply With Quote #10

Will this work?

Events are captured in Post so they've already happened...
__________________
egg
BAILOPAN 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 21:13.


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