Raised This Month: $ Target: $400
 0% 

Death Pre


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 08-13-2010 , 08:02   Death Pre
Reply With Quote #1

Alright, it creates the death message when a CT gets killed like its supposed to. But when a T gets killed, it wont show a death message. For example:

When a CT gets killed:



But when the T dies, it doesn't display a message at all.

Here is the code I used to block/create a new death message:

PHP Code:
stock create_deathmsg(idvictimheadshotweapon_name[])
{
    
message_begin(MSG_ALL,get_user_msgid("DeathMsg"),{0,0,0},0);
    
write_byte(id);
    
write_byte(victim);
    
write_byte(headshot);
    
write_string(weapon_name);
    
message_end();

PHP Code:
RegisterHamHam_Killed"player""eDeathPre"
PHP Code:
public eDeathPreiVictimiAttackershouldgib )
{
    if( 
cs_get_user_team(iVictim) == CS_TEAM_CT && cs_get_user_team(iAttacker) == CS_TEAM_T )
    {
        new 
frags get_user_frags(iAttacker)
        
set_user_fragsiAttackerfrags )
        
        
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET);
        
create_deathmsg(0iVictim1"nothing");
        
        if( 
gInLR[iVictim] == true )
        {
            
gInLR[iVictim] = false;
            
gLastRequest false;
            
            return 
HAM_HANDLED;
        }
        
        return 
HAM_HANDLED;
    }
    
    return 
HAM_HANDLED;

__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 08-13-2010 , 08:20   Re: Death Pre
Reply With Quote #2

Try this code by ConnorMcleod:
PHP Code:
/*    Formatright © 2009, ConnorMcLeod 

    Jail Hide Ts Kills 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 Jail Hide Ts Kills; if not, write to the 
    Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
    Boston, MA 02111-1307, USA. 
*/ 

#include <amxmodx> 
#include <cstrike> 

#define VERSION "0.0.2" 

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

new g_iMaxPlayers 

public plugin_init() 

    
register_plugin("Jail Hide Ts Kills"VERSION"ConnorMcLeod"

    
register_message(get_user_msgid("DeathMsg"), "Message_DeathMsg"

    
g_iMaxPlayers get_maxplayers() 


public 
Message_DeathMsg() 

    new 
iKiller get_msg_arg_int(1
    if( 
IsPlayer(iKiller) && cs_get_user_team(iKiller) == CS_TEAM_T 
    { 
        
set_msg_arg_int(1ARG_BYTEget_msg_arg_int(2)) 
    } 

__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 08-13-2010 , 19:39   Re: Death Pre
Reply With Quote #3

Also, the code you have will keep the attacker in Last Request if he is in it.
__________________
Hi.
Kreation is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-13-2010 , 21:45   Re: Death Pre
Reply With Quote #4

Last version has more features.

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"h")
                
get_msg_arg_string(DeathMsg_TruncatedWeaponNameszTruncatedWeaponNamecharsmax(szTruncatedWeaponName))
                for(new 
ii<iNumi++)
                {
                    
id iPlayers[i]
                    if( 
cs_get_user_team(id) == CS_TEAM_T )
                    {
                        
emessage_begin(MSG_ONEg_iDeathMsg, .player=id)
                        {
                            
ewrite_byte(KillerID)
                            
ewrite_byteget_msg_arg_intDeathMsg_VictimID ) )
                            
ewrite_byteget_msg_arg_intDeathMsg_IsHeadshot ) )
                            
ewrite_string(szTruncatedWeaponName)
                        }
                        
emessage_end()
                    }
                }
                return 
PLUGIN_HANDLED
            
}
        }
    }
    return 
PLUGIN_CONTINUE

__________________
- tired and retired -

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


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