Raised This Month: $ Target: $400
 0% 

msgID (death)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bibu
Veteran Member
Join Date: Sep 2010
Old 11-20-2010 , 11:02   msgID (death)
Reply With Quote #1

I am hooking it like that:

PHP Code:
register_messageget_user_msgid"DeathMsg" ) , "fw_EvDeathMsg" ); 
Then I have this:

PHP Code:
public fw_EvDeathMsgmsg_id msg_dest msg_entity 
Now what or who/would be msg_id , msg_dest?

Is msg_id the person who died or am I off the mark?

or can I use something like this:

PHP Code:
public fw_EvDeathMsgmsg_id msg_dest msg_entity )
{
    if ( 
cs_get_user_team(msg_id) == )  //died person?
    
{
        
client_print(0print_chat"a Terrorist died.")
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;

bibu is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-20-2010 , 11:09   Re: msgID (death)
Reply With Quote #2

msg_id is equal to get_user_msgid() value, that is usefull in case you would use same callback for multiple registered messages (kind of stupid)
msg_dest is MSG_ONE, MSG_ALL etc..., in case of DeathMsg, it can be MSG_BROADCAST or MSG_ALL.
msg_entity is the player who the message is sent to, in your case it's 0 because DeathMsg is sent to all players at the same time using MSG_ALL or MSG_BROADCAST.

If you want an example on how to hide T kills (note that i don't use any of msg_id, msg_dest nor msg_entity params) :
PHP Code:
/*    Formatright © 2009, ConnorMcLeod

    Hide T Frags is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Hide T Frags; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <cstrike>

new const VERSION[] = "0.1.0"

const MAX_PLAYERS 32

enum 
/*_:DeathMsg_Structure*/
{    
    
DeathMsg_KillerID 1// byte
    
DeathMsg_VictimID// byte
    
DeathMsg_IsHeadshot// byte
    
DeathMsg_TruncatedWeaponName // string
}

new 
g_iMaxPlayers
#define IsPlayer(%1)    ( 1 <= %1 <= g_iMaxPlayers )

new g_pCvarHideType
new g_iDeathMsg

public plugin_init()
{
    
register_plugin("Hide T Frags"VERSION"ConnorMcLeod")

    
g_pCvarHideType register_cvar("jb_hide_te_frags""1"// 0:inactive, 1:hide killer, 2:hide frag

    
g_iDeathMsg get_user_msgid("DeathMsg")
    
register_message(g_iDeathMsg"Message_DeathMsg")

    
g_iMaxPlayers get_maxplayers()
}

public 
Message_DeathMsg()
{
    new 
KillerID get_msg_arg_intDeathMsg_KillerID )
    if( 
IsPlayerKillerID ) && cs_get_user_teamKillerID ) == CS_TEAM_T )
    {
        switch( 
get_pcvar_numg_pCvarHideType ) )
        {
            case 
1:
            {
                
set_msg_arg_int(DeathMsg_KillerIDARG_BYTEget_msg_arg_intDeathMsg_VictimID ))
            }
            case 
2:
            {
                return 
PLUGIN_HANDLED
            
}
            case 
3:
            {
                new 
iPlayers[MAX_PLAYERS], iNumidszTruncatedWeaponName[16]
                
get_players(iPlayersiNum"ch")
                
get_msg_arg_string(DeathMsg_TruncatedWeaponNameszTruncatedWeaponNamecharsmax(szTruncatedWeaponName))
                for(new 
ii<iNumi++)
                {
                    
id iPlayers[i]
                    if( 
cs_get_user_team(id) == CS_TEAM_T )
                    {
                        
message_begin(MSG_ONEg_iDeathMsg, .player=id)
                        {
                            
write_byte(KillerID)
                            
write_byteget_msg_arg_intDeathMsg_VictimID ) )
                            
write_byteget_msg_arg_intDeathMsg_IsHeadshot ) )
                            
write_string(szTruncatedWeaponName)
                        }
                        
message_end()
                    }
                }
                return 
PLUGIN_HANDLED
            
}
        }
    }
    return 
PLUGIN_CONTINUE

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 11-20-2010 at 11:11.
ConnorMcLeod is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 11-20-2010 , 11:09   Re: msgID (death)
Reply With Quote #3

get_msg_arg_int()
DeathMsg
__________________
xPaw is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 11-20-2010 , 12:25   Re: msgID (death)
Reply With Quote #4

Quote:
Originally Posted by bibu View Post
I didn't want to hide the T's, thanks for your explanation, I just would like to find out with register_message( get_user_msgid( "DeathMsg" ) , "fw_EvDeathMsg" );

and

public fw_EvDeathMsg( msg_id , msg_dest , msg_entity )

how to get the killed player like in e_deathmsg with:

new iKiller = read_data(1);
new iVictim = read_data(2);
Quote:
Originally Posted by xPaw View Post
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 11-20-2010 , 11:27   Re: msgID (death)
Reply With Quote #5

I didn't want to hide the T's, thanks for your explanation, I just would like to find out with register_message( get_user_msgid( "DeathMsg" ) , "fw_EvDeathMsg" );

and

public fw_EvDeathMsg( msg_id , msg_dest , msg_entity )

how to get the killed player like in e_deathmsg with:

new iKiller = read_data(1);
new iVictim = read_data(2);
bibu is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 11-20-2010 , 14:15   Re: msgID (death)
Reply With Quote #6

I really don't understand this, can you show me an example please?

So something like this?

PHP Code:
get_msg_arg_int
But how to get the team of it? or something other?
bibu is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-20-2010 , 15:22   Re: msgID (death)
Reply With Quote #7

Quote:
Originally Posted by bibu View Post
I really don't understand this, can you show me an example please?

So something like this?

PHP Code:
get_msg_arg_int
But how to get the team of it? or something other?
And how do you get team of read_data(1) ??

It's the same.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 11-20-2010 , 16:05   Re: msgID (death)
Reply With Quote #8

Quote:
Originally Posted by ConnorMcLeod View Post
And how do you get team of read_data(1) ??

It's the same.
By using iKiller as the id.

So can I use:

PHP Code:
new iKiller get_msg_arg_int)

new 
iVictim get_msg_arg_int
bibu is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 11-20-2010 , 16:07   Re: msgID (death)
Reply With Quote #9

Quote:
Originally Posted by bibu View Post
By using iKiller as the id.

So can I use:

PHP Code:
new iKiller get_msg_arg_int)

new 
iVictim get_msg_arg_int
Yes.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-20-2010 , 16:09   Re: msgID (death)
Reply With Quote #10

That's why i showed you the code in my first answer...
__________________
- 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 11:21.


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