AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   *DEAD* (https://forums.alliedmods.net/showthread.php?t=65229)

hugz` 01-04-2008 00:46

*DEAD*
 
Is it possible for dead players not to see other dead people's '*DEAD* tag?
Here's the code, I already have it so alive people don't see '*DEAD*', I need the same for non living, that also includes team chat when dead.

PHP Code:

#include <amxmodx>

#define FLAG ADMIN_RESERVATION
#define VERSION "1.1"

new COLCHAR[3][2] = { "^x03"/*team col*/"^x04"/*green*/"^x01"/*white*/ }

//cvar pointers
new p_allchatp_namecolp_msgcolp_alltalkp_hidestatp_teamchat

//vars to check if message has already been duplicated
new alv_sndralv_str2[26], alv_str4[101]
new 
msg[200]

public 
col_changermsg_idmsg_destrcvr )
{
    new 
str2[26]
    
get_msg_arg_string2str225 )
    if( 
equalstr2"#Cstrike_Chat"13 ) )
    {
        new 
str3[22]
        
get_msg_arg_string3str321 )
        
        if( !
strlenstr3 ) )
        {
            new 
str4[101]
            
get_msg_arg_string4str4100 )
            new 
sndr get_msg_arg_int)
            
            new 
bool:is_team_msg = !bool:equalstr2"#Cstrike_Chat_All"17 )
            
            new 
sndr_team get_user_teamsndr )
            new 
bool:is_sndr_spec = !bool:( sndr_team )
            
            new 
namecol clampget_pcvar_num(p_namecol), 0)
            new 
msgcol clampget_pcvar_num(p_msgcol), 0)
            
            new 
bool:same_as_last bool:( alv_sndr == sndr && equalalv_str2str2 ) && equalalv_str4str4) )
            
            if( !
same_as_last )
            {
//Duplicate message once
                
new allchat clampget_pcvar_nump_allchat ), 0)
                if( 
allchat == || ( allchat == && clampget_pcvar_nump_alltalk ), 0) == ) )
                {
                    if( !( 
is_team_msg && ( is_sndr_spec || is_team_msg && get_pcvar_nump_teamchat ) == ) ) )
                    {
//Don't duplicate if it's a spectator team message
                        
new flags[5], team[10]
                        if( 
is_user_alivesndr ) ) flags "bch"
                        
else flags "ach"
                        
                        
if( is_team_msg )
                        {
                            
addflags[strlenflags )], 4"e" )
                            if( 
sndr_team == team "TERRORIST"
                            
else team "CT"
                        
}
                        
                        new 
players[32], num
                        get_players
playersnumflagsteam )

                        if( 
get_user_flagssndr ) & FLAG )
                            
buildmsgsndris_sndr_specis_team_msgsndr_teamnamecolmsgcolstr4 //admin colored, by cvars
                        
else buildmsgsndris_sndr_specis_team_msgsndr_team02str4 //normal colors
                        
                        
for( new i=0numi++ )
                        {
                            
message_beginMSG_ONEget_user_msgid"SayText" ), _players[i] )
                            
write_bytesndr )
                            
write_stringmsg )
                            
message_end()
                        }
                        
                    }
    
                    
alv_sndr sndr
                    alv_str2 
str2
                    alv_str4 
str4
                    
if( task_exists411 ) ) remove_task411 )
                    
set_task0.1"task_clear_antiloop_vars"411 )
                }
            }
            
            if( 
get_user_flagssndr ) & FLAG && ( namecol != || msgcol != ) )
            {
//execute if sndr is admin and cols are not set to engine defaults
                
if( !same_as_last buildmsgsndris_sndr_specis_team_msgsndr_teamnamecolmsgcolstr4 )

                
set_msg_arg_string2msg )
                
set_msg_arg_string4"" )
            }
        }
    }
    return 
PLUGIN_CONTINUE
}

public 
buildmsgsndris_sndr_specis_team_msgsndr_teamnamecolmsgcolstr4[ ] )
{
    new 
sndr_name[33]
    
get_user_namesndrsndr_name32 )
    
    new 
prefix[30] = "^x01"
    
if( get_pcvar_nump_hidestat ) == )
    {
        if( 
is_sndr_spec prefix "^x01*SPEC* "
        
else if( !is_user_alivesndr ) ) prefix "^x01*DEAD* "
    
}
    
    if( 
is_team_msg )
    {
        if( 
is_sndr_spec prefix "^x01(Spectator) "
        
else if( sndr_team == addprefix[strlen(prefix)-1], 29"(Terrorist) " )
        else if( 
sndr_team == addprefix[strlen(prefix)-1], 29"(Counter-Terrorist) " )
    }
    
    
formatmsg199"%s%s%s :  %s%s",\
        
strlenprefix ) > prefix "",\
        
COLCHAR[namecol], sndr_nameCOLCHAR[msgcol], str4 )
    return 
PLUGIN_HANDLED
}

public 
task_clear_antiloop_vars( )
{
    
alv_sndr 0
    alv_str2 
""
    
alv_str4 ""
    
return PLUGIN_HANDLED
}

public 
plugin_init( )
{
    
register_plugin("All Chat",VERSION,"Ian Cammarata")
    
register_cvar("allchat_version",VERSION,FCVAR_SERVER)
    
    
p_allchat register_cvar"sv_allchat""1" )
    
p_namecol register_cvar"ac_namecolor""0" )
    
p_msgcol register_cvar"ac_msgcolor""1" )
    
p_hidestat register_cvar"ac_hidestatus""0" )
    
p_teamchat register_cvar"ac_teamchat""0" )
    
    
p_alltalk get_cvar_pointer"sv_alltalk" )
    
    
register_messageget_user_msgid("SayText"), "col_changer" )
    return 
PLUGIN_CONTINUE



hugz` 01-05-2008 10:52

Re: *DEAD*
 
Anyone?

lolhax44 01-05-2008 11:33

Re: *DEAD*
 
IT is possible
Can you put ur code in [PHP] Tags its more eazyer to see then :P
PHP Code:

if( equalstr2"#Cstrike_Chat"13 ) ) 

I think it's
PHP Code:

if( equalstr2"#Cstrike_DEAD"13 ) ) 


hugz` 01-05-2008 11:44

Re: *DEAD*
 
There you go, didn't know how to =p

lolhax44 01-05-2008 16:16

Re: *DEAD*
 
1 Attachment(s)
There That should work

hugz` 01-05-2008 16:41

Re: *DEAD*
 
Doesn't work.. =/ I can still see *DEAD*

lolhax44 01-05-2008 18:01

Re: *DEAD*
 
maybe it only works with #define FLAG ADMIN_RESERVATION and removes there Dead sign off

hugz` 01-05-2008 19:19

Re: *DEAD*
 
I don't get it.. maybe you don't understood what I am trying to get rid off?

When I'm dead, I don't want to see *DEAD* tag when I or someone else says.

kp_uparrow 01-05-2008 20:23

Re: *DEAD*
 
hook saytext, remove dead from string, resend message, block original message

hugz` 01-05-2008 22:25

Re: *DEAD*
 
Could you give me a hint on what line I should edit? Don't just post the code I'm trying to learn..

Or give me some links on how to hook say text, and all that.

Thanks.


All times are GMT -4. The time now is 11:04.

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