Raised This Month: $ Target: $400
 0% 

Hide deathmsg


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Snoozy
New Member
Join Date: Apr 2012
Old 04-22-2012 , 12:04   Hide deathmsg
Reply With Quote #1

Hey I recently started with amx mod x scripting however, I can't seem to figure out, how to hide the deathmsg, from when a player gets killed, I don't want every single one of them hidden, but more specifically only when a player gets killed by set_user_health(arg1,arg2).

Is there some easy workaround for this to hide it when set_user_health is used?
Snoozy is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 04-22-2012 , 12:28   Re: Hide deathmsg
Reply With Quote #2

Hook DeathMsg through register_message and return PLUGIN_HANDLED and it.

Spoiler
__________________


Last edited by NiHiLaNTh; 04-22-2012 at 12:28.
NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
Snoozy
New Member
Join Date: Apr 2012
Old 04-22-2012 , 13:04   Re: Hide deathmsg
Reply With Quote #3

Okay so I still can't manage to get it working, this is what I did, apologies in advance, I'm probably failing.

This is the function
Code:
public hook_deathmsg(msgId,msgDest,iReceiver){
    new pevVictim = get_msg_arg_int( 2 )
    if(UserData[pevVictim][HideDeathMSG]==true){
		UserData[pevVictim][HideDeathMSG]=false
		return PLUGIN_HANDLED
	}
    return PLUGIN_CONTINUE
}
This is the code in plugin init
Code:
public plugin_init(){
	register_plugin("Main","1.0","Snoozy")
	gmsgDeathMsg = get_user_msgid("DeathMsg")
	register_message(gmsgDeathMsg,"hook_deathmsg")
}
Snoozy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-23-2012 , 00:26   Re: Hide deathmsg
Reply With Quote #4

PHP Code:

#include <amxmodx>
#include <hamsandwich>

new bool:g_bTookDamage33 ];

public 
plugin_init() 
{
    
RegisterHamHam_TakeDamage "player" "HamTakeDamage_Pre" );
    
RegisterHamHam_TakeDamage "player" "HamTakeDamage_Post" );

    
register_messageget_user_msgid"DeathMsg" ) , "Ev_DeathMsg" );
}

public 
HamTakeDamage_PreiPlayer )
{
    
g_bTookDamageiPlayer ] = true;
}

public 
HamTakeDamage_PostiPlayer )
{
    
g_bTookDamageiPlayer ] = false;
}

public 
Ev_DeathMsgmsgId ,msgDest ,iReceiver )
{
    return 
g_bTookDamageget_msg_arg_int) ] ? PLUGIN_CONTINUE PLUGIN_HANDLED;

__________________
Bugsy 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 07:51.


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