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

[question] print_chat messages


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
darkman488
New Member
Join Date: Mar 2008
Location: Cracow, Poland.
Old 02-08-2009 , 09:42   [question] print_chat messages
Reply With Quote #1

Hello! I've got one question, is there any way to recive/get messages printed by other plugin with print_chat? I didn't found any topic about this, so I write new one, but if it exist - sorry, I didn't know how to type great keyword for this. Waitin 4 respond +karma for useful posts.

Last edited by darkman488; 02-08-2009 at 09:45.
darkman488 is offline
Send a message via Skype™ to darkman488
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-08-2009 , 09:55   Re: [question] print_chat messages
Reply With Quote #2

If you code yourself the plugin and use emessage, yes.

You can use this :
It supports default game message, for example :

ClientPrint(iKiller, print_center, "#Killed_Teammate") // print center : You have killed a teamate

or

ClientPrint(id, print_chat, "#Game_teammate_attack", szName)
// print in chat : "Name attacked a teamate"


Doesn't format strings as client_print does, for example you can do :

client_print(id, print_chat, "Your id is %d", id)
%d will be replaced with id value
You can't do it with ClientPrint
I could make another fonction for it, or change some code in the existing function, i just had this one ready, so i give it to you.

PHP Code:
ClientPrint(idprint_typeszText[], szSubMsg1[] = 0szSubMsg2[] = 0szSubMsg3[] = 0szSubMsg4[] = 0)
{
    new 
MSG_DEST = (id MSG_ONE MSG_ALL)
    
emessage_begin(MSG_DESTget_user_msgid("TextMsg"), _id)
    
ewrite_byte(print_type)
    
ewrite_string(szText)
    if( 
szSubMsg1[0] )
    {
        
ewrite_string(szSubMsg1)
        if( 
szSubMsg2[0] )
        {
            
ewrite_string(szSubMsg2)
            if( 
szSubMsg3[0] )
            {
                
ewrite_string(szSubMsg3)
                if( 
szSubMsg4[0] )
                {
                    
ewrite_string(szSubMsg4)
                }
            }
        }
    }
    
emessage_end()

(Replace get_user_msgid("TextMsg") with a globale var )


Then, to catch it in another plugin, just register the event TextMsg :

register_event("TextMsg", "Event_TextMsg", "b" /* or "a" */)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 06:38.


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