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

Register a hudmessage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 04-24-2008 , 14:58   Register a hudmessage
Reply With Quote #1

Hi !

This might have been answered but if I
search about it I'm just finding topics about "set_hudmessage()"

For example on a kz map, in the end it comes up a hud
message for example "yay you made it". Is there someway i can register it and check
what it "says" ?

FYI the entity whom is displaying the message is "env_message"
__________________
atomen is offline
Send a message via MSN to atomen
Old 04-25-2008, 13:28
[X]-RayCat
This message has been deleted by [X]-RayCat. Reason: :)
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 04-25-2008 , 14:00   Re: Register a hudmessage
Reply With Quote #2

Nope not what i meant :/
But thanks anyway

I want to register the message from an "env_message" whom is
built in the maps.
__________________
atomen is offline
Send a message via MSN to atomen
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-25-2008 , 14:00   Re: Register a hudmessage
Reply With Quote #3

You have to register message SVC_TEMPENTITY, filter out to catch TE_TEXTMESSAGE as first arg, then retrieve the 18th arg string.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 04-25-2008 , 14:50   Re: Register a hudmessage
Reply With Quote #4

Any demonstrations ?
__________________
atomen is offline
Send a message via MSN to atomen
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-25-2008 , 14:58   Re: Register a hudmessage
Reply With Quote #5

Probably something like that :

Code:
    register_message ( SVC_TEMPENTITY, "m_TextMessage" );         m_TextMessage ( msg_id, msg_type, msg_entity )     {         if ( get_msg_arg_int ( 1 ) == TE_TEXTMESSAGE )         {             new s_Message[ 256 ];             get_msg_arg_string ( 18, s_Message, charsmax ( s_Message ) );                         log_amx ( "s_Message = %s", s_Message );         }     }
__________________
Arkshine is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 04-25-2008 , 16:00   Re: Register a hudmessage
Reply With Quote #6

I'm receiving 2 errors with the script whom I were unable to solve.
Quote:
L 04/25/2008 - 21:54:56: Invalid message argument 18
L 04/25/2008 - 21:54:56: [AMXX] Displaying debug trace (plugin "amx_regmsg.amxx")
L 04/25/2008 - 21:54:56: [AMXX] Run time error 10: native error (native "get_msg_arg_string")
L 04/25/2008 - 21:54:56: [AMXX] [0] amx_regmsg.sma::m_TextMessage (line 19)
PHP Code:
#include <amxmodx>
#include <amxmisc>

new pcvar

public plugin_init()
{
    
register_plugin("Register Hud Message""1.0""Author")
    
register_messageSVC_TEMPENTITY"m_TextMessage" )

    
pcvar register_cvar("amx_reg_msg""1")
}
    
public 
m_TextMessage msg_idmsg_typemsg_entity )
{
    if ( 
get_msg_arg_int ) == TE_TEXTMESSAGE && get_pcvar_num(pcvar))
    {
        new 
s_Message256 ];
        
get_msg_arg_string 18s_Messagecharsmax s_Message ) )
            
        
client_print(0print_chat"s_Message = %s"s_Message )
    }

__________________
atomen is offline
Send a message via MSN to atomen
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-25-2008 , 16:08   Re: Register a hudmessage
Reply With Quote #7

Try using :

Code:
get_msg_arg_string ( get_msg_args (), s_Message, charsmax ( s_Message ) );
__________________
Arkshine is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 04-25-2008 , 16:56   Re: Register a hudmessage
Reply With Quote #8

Thank you arkshine worked perfect.
Though sometimes "env_message" isn't triggered.

But this is probably the closest you can get :/

EDIT: How could I retrieve the id of the user whom is seeing the message ?
__________________

Last edited by atomen; 04-25-2008 at 17:11.
atomen is offline
Send a message via MSN to atomen
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-25-2008 , 17:19   Re: Register a hudmessage
Reply With Quote #9

msg_entity = player id

EDIT : hadn't well understood what arkshine told you, that's the way
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 04-25-2008 at 17:45.
ConnorMcLeod is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 04-25-2008 , 17:34   Re: Register a hudmessage
Reply With Quote #10

I'm making a plugin for my friend.
Specialized on surf_simpsons_final.

When they join they get godmode but you can cheat on "Level 4"(hudmessage) with godmode so I'm registering the message and remove
the users godmode. And when they are on any other level they receive godmode again.

But the hudmessage isn't always displayed =/
__________________
atomen is offline
Send a message via MSN to atomen
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 07:23.


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