AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hide deathmsg (https://forums.alliedmods.net/showthread.php?t=183497)

Snoozy 04-22-2012 12:04

Hide deathmsg
 
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?

NiHiLaNTh 04-22-2012 12:28

Re: Hide deathmsg
 
Hook DeathMsg through register_message and return PLUGIN_HANDLED and it.

Spoiler

Snoozy 04-22-2012 13:04

Re: Hide deathmsg
 
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")
}


Bugsy 04-23-2012 00:26

Re: Hide deathmsg
 
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;




All times are GMT -4. The time now is 07:51.

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