AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hud message (https://forums.alliedmods.net/showthread.php?t=172591)

made.tn 11-23-2011 06:15

Hud message
 
1 Attachment(s)
I'm new in this forum

PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "hudmessage"
#define VERSION "1.0"
#define AUTHOR "made.tn"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say hi""hi_msg")
    
register_clcmd("say by""by_msg")
    
register_clcmd("say plugin""plg_msg")
    
register_clcmd("say amxx""amx_msg")
}



public 
hi_msg(id)
{
    
set_hudmessage(00255, -1.00.3503.01.21.31.44)
    
show_hudmessage(id"Hello client have fun ;)")
    return 
PLUGIN_CONTINUE
}


public 
by_msg(id)
{
    
set_hudmessage(25500, -1.00.3503.01.21.31.44)
    
show_hudmessage(id"by arrive tomorrow :)")
    return 
PLUGIN_CONTINUE
}

public 
plg_msg(id)
{
    
set_hudmessage(02550, -1.00.3503.01.21.31.44)
    
show_hudmessage(id"plugin made by made.tn")
    return 
PLUGIN_CONTINUE
}

public 
amx_msg(id)
{
    
set_hudmessage(00255, -1.00.3503.01.21.31.44)
    
show_hudmessage(id"Go to the official website AMXMODX.ORG")
    return 
PLUGIN_CONTINUE



Napoleon_be 11-23-2011 06:35

Re: Headshot hudmessage
 
PHP Code:

register_event("DeathMsg""eDeath""a""1>0""2>0""3=1"

PHP Code:

public eDeath(id) {
      
set_hudmessage(25500, -1.00.3503.01.21.31.44)
      
show_hudmessage(id"Headshot!")



fl0werD 11-23-2011 06:35

Re: Headshot hudmessage
 
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

public plugin_init()
    
RegisterHam(Ham_Killed"player""PlayerKilledPost"1)

public 
PlayerKilledPost(victimattackershouldgib)
{
    if(!
is_user_connected(attacker))
        return;

    if(
victim == attacker)
        return;

    if(
get_pdata_int(victim75) != HIT_HEAD)
        return;

    
set_hudmessage(2001000, -1.00.3003.03.00.150.151)
    
show_hudmessage(attacker"::HEADSHOT::")



made.tn 11-23-2011 06:53

Re: Headshot hudmessage
 
:) thanks all

Erox902 11-23-2011 07:00

Re: Headshot hudmessage
 
Quote:

Originally Posted by fl0werD (Post 1601236)
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

public plugin_init()
    
RegisterHam(Ham_Killed"player""PlayerKilledPost"1)

public 
PlayerKilledPost(victimattackershouldgib)
{
    if(!
is_user_connected(attacker))
        return;

    if(
victim == attacker)
        return;

    if(
get_pdata_int(victim75) != HIT_HEAD)
        return;

    
set_hudmessage(2001000, -1.00.3003.03.00.150.151)
    
show_hudmessage(attacker"::HEADSHOT::")



Why include ham and fakemeta for something you can do in a much simpler way, with lot less module communication?

Devil259 11-23-2011 07:02

Re: Headshot hudmessage
 
Quote:

Originally Posted by Napoleon_be (Post 1601235)
PHP Code:

register_event("DeathMsg""eDeath""a"

PHP Code:

public eDeath(id) {
      
set_hudmessage(25500, -1.00.3503.01.21.31.44)
      
show_hudmessage(id"Headshot!")



id equal 0 in your case.

Code:
public eDeath(id) {       new attacker = read_data( 1 )             if( read_data( 3 ) )       {             set_hudmessage(255, 0, 0, -1.0, 0.35, 0, 3.0, 1.2, 1.3, 1.4, 4)             show_hudmessage(attacker, "Headshot!")       } }

made.tn 11-23-2011 07:18

Re: Headshot hudmessage
 
thanks also to Devil259 and Erox902

made.tn 11-23-2011 07:21

Re: Headshot hudmessage
 
Quote:

register_event("DeathMsg", "eDeath", "a")
what's the "a" ???

Devil259 11-23-2011 07:48

Re: Headshot hudmessage
 
EDIT your post instead of re-posting.

http://www.amxmodx.org/funcwiki.php?...vent&go=search

Quote:

register_event ( const event[], const function[], const flags[], [ cond=[], ... ] )

event is a message, such as "DeathMsg", "Damage", et cetera.

function is the name of a public function which will be called on this event.

flags is a combination of flags that determine if this event is forwarded:
"a" - Global Event
"b" - Event sent to a single target
"c" - Send only once when repeated to other players
"d" - Only if sent to a dead player
"e" - Only if sent to an alive player

raghunarnindi001 11-23-2011 08:06

Re: Headshot hudmessage
 
I think you must also use register_event( "ResetHUD" , <functionname> , flags ,......,)

"a" - Global Event
"b" - Event sent to a single target
"c" - Send only once when repeated to other players
"d" - Only if sent to a dead player
"e" - Only if sent to an alive player


All times are GMT -4. The time now is 08:31.

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