AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   set,show hud message,won't be shown. (https://forums.alliedmods.net/showthread.php?t=82740)

xbatista 12-29-2008 03:33

set,show hud message,won't be shown.
 
PHP Code:

public Event_DeathMsg() 

    new 
attacker read_data(1)
    new 
victim read_data(2)


if(
attacker != victim)
    {
        if (
get_user_team(victim) == 2)
        {
    for(new 
0iNum; ++i)
    {
    new 
id Players[i]
        new 
attacker_msg[32]
        new 
victim_msg[32]
    
get_user_name(attackerattacker_msg31)
    
get_user_name(victimvictim_msg31)
        
set_hudmessage(255010, -1.40.3010.011.50.010.01
        
show_hudmessage(id"%s's brains has been eaten by %s!"victim_msgattacker_msg)
        
client_cmdi"spk %s"music1[random_num(0,sizeof music1 1)]);
        } 

I wanna show message to all,but it won't show.



EDIT: Oh,I solved problem.
Must be this yes?
PHP Code:

if(attacker != victim
    { 
        if (
get_user_team(victim) == 2
        { 
    for(new 
0iNum; ++i
    { 
    new 
id Players[i
        
set_hudmessage(255010, -1.40.3010.011.50.010.01)  
        
show_hudmessage(id"%s's brains has been eaten by %s!"victimattacker
        
client_cmdi"spk %s"music1[random_num(0,sizeof music1 1)]); 
        } 

Or,no?
This is a good way?

ianglowz 12-29-2008 03:57

Re: set,show hud message,won't be shown.
 
Quote:

Originally Posted by xbatista (Post 734805)
[php]
EDIT: Oh,I solved problem.
Must be this yes?
PHP Code:

if(attacker != victim
    { 
        if (
get_user_team(victim) == 2
        { 
    for(new 
0iNum; ++i
    { 
    new 
id Players[i
        
set_hudmessage(255010, -1.40.3010.011.50.010.01)  
        
show_hudmessage(id"%s's brains has been eaten by %s!"victimattacker
        
client_cmdi"spk %s"music1[random_num(0,sizeof music1 1)]); 
        } 

Or,no?
This is a good way?

Had you tested it?

xbatista 12-29-2008 04:01

Re: set,show hud message,won't be shown.
 
YES.

ianglowz 12-29-2008 04:03

Re: set,show hud message,won't be shown.
 
Result?

xbatista 12-29-2008 04:19

Re: set,show hud message,won't be shown.
 
Quote:

EDIT: Oh,I solved problem.
But maybe I'm doing something bad.

ianglowz 12-29-2008 04:24

Re: set,show hud message,won't be shown.
 
Clean code I think.

xbatista 12-29-2008 04:39

Re: set,show hud message,won't be shown.
 
Oops this is correct(I have a headache xD) :mrgreen: :
PHP Code:

if(attacker != victim
    { 
        if (
get_user_team(victim) == 2
        { 
    for(new 
0iNum; ++i
    { 
    new 
id Players[i
        new 
attacker_msg[32
        new 
victim_msg[32
    
get_user_name(attackerattacker_msg31
    
get_user_name(victimvictim_msg31
        
set_hudmessage(255010, -1.40.3010.011.50.010.01)  
        
show_hudmessage(id"%s's brains has been eaten by %s!"victim_msgattacker_msg
        
client_cmdi"spk %s"music1[random_num(0,sizeof music1 1)]); 
        } 


ianglowz 12-29-2008 04:43

Re: set,show hud message,won't be shown.
 
Code:

I wanna show message to all,but it won't show.
Why you saying this?

xPaw 12-29-2008 04:55

Re: set,show hud message,won't be shown.
 
PHP Code:

if(attacker != victim) {
    if (
get_user_team(victim) == 2) {
        new 
attacker_msg[32], victim_msg[32];

        
get_user_name(attackerattacker_msg31);
        
get_user_name(victimvictim_msg31);

        
set_hudmessage(255010, -1.40.3010.011.50.010.01);
        
show_hudmessage(0"%s's brains has been eaten by %s!"victim_msgattacker_msg);
        
client_cmd0"spk %s"music1[random_num(0,sizeof music1 1)]);
        
// no need to loop throught all players, hud can be shown just for all by id: 0
    
}



xbatista 12-29-2008 05:05

Re: set,show hud message,won't be shown.
 
WoW, thx xPaw.


All times are GMT -4. The time now is 09:19.

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