Raised This Month: $ Target: $400
 0% 

[REQ] AllChat Tag


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
plazma
Senior Member
Join Date: Oct 2013
Old 05-18-2014 , 04:08   [REQ] AllChat Tag
Reply With Quote #1

How i can add this tag when livin players *ALIVE* and dead player can see alive players in chat this tag *ALIVE* plazma : Hi

thnx.


Code:
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

__________________
Free Palestine ♥
plazma is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 05-18-2014 , 05:23   Re: [REQ] AllChat Tag
Reply With Quote #2

PHP Code:
    formatmsg199"%s%s%s :  %s%s",\
    
strlenprefix ) > prefix "",\
    
COLCHAR[namecol], sndr_nameCOLCHAR[msgcol], str4 )
    return 
PLUGIN_HANDLED 
->
PHP Code:
    formatmsg199"%s%s%s%s :  %s%s",
    
is_user_alive(sndr) ? "*ALIVE*" "",\
    
strlenprefix ) > prefix "",\
    
COLCHAR[namecol], sndr_nameCOLCHAR[msgcol], str4 )
    return 
PLUGIN_HANDLED 
__________________

Last edited by Flick3rR; 05-18-2014 at 05:25.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
plazma
Senior Member
Join Date: Oct 2013
Old 05-18-2014 , 05:28   Re: [REQ] AllChat Tag
Reply With Quote #3

Quote:
Originally Posted by Flick3rR View Post
PHP Code:
    formatmsg199"%s%s%s :  %s%s",\
    
strlenprefix ) > prefix "",\
    
COLCHAR[namecol], sndr_nameCOLCHAR[msgcol], str4 )
    return 
PLUGIN_HANDLED 
->
PHP Code:
    formatmsg199"%s%s%s%s :  %s%s",
    
is_user_alive(sndr) ? "*ALIVE*" "",\
    
strlenprefix ) > prefix "",\
    
COLCHAR[namecol], sndr_nameCOLCHAR[msgcol], str4 )
    return 
PLUGIN_HANDLED 
Thns but look this not have colors.... ??

__________________
Free Palestine ♥
plazma is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 05-18-2014 , 05:57   Re: [REQ] AllChat Tag
Reply With Quote #4

Uhm... I've just added the *ALIVE* tag in front of everything, didn't change nothing else in the code. I'll check uot again, but it doesn't seem to be the reason...
EDIT: Try to put ^x01 in front of *ALIVE* in the code and see the results.
__________________

Last edited by Flick3rR; 05-18-2014 at 06:02.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
plazma
Senior Member
Join Date: Oct 2013
Old 05-18-2014 , 06:00   Re: [REQ] AllChat Tag
Reply With Quote #5

Ah, thanks alot anyone please...
__________________
Free Palestine ♥
plazma is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 05-18-2014 , 06:07   Re: [REQ] AllChat Tag
Reply With Quote #6

Yes, I saw the problem. It's cause because this variable 'prefix' already includes a check for player dead and makes the prefix *DEAD*. So I just added in the function, where this defines, another check to make the prefix *ALIVE*.
This should already work:
PHP Code:
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* "
        
else if( is_user_alivesndr ) ) prefix "^x01*ALIVE* "
    
}
    
    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

Replace the whole function.
Or if you want to know what did I do, I just added
PHP Code:
else if( is_user_alivesndr ) ) prefix "^x01*ALIVE* " 
In these lines:
PHP Code:
if( get_pcvar_nump_hidestat ) == )
    {
        if( 
is_sndr_spec prefix "^x01*SPEC* "
        
else if( !is_user_alivesndr ) ) prefix "^x01*DEAD* "
    

__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
plazma
Senior Member
Join Date: Oct 2013
Old 05-18-2014 , 06:18   Re: [REQ] AllChat Tag
Reply With Quote #7

I've done this but it does not work out so Living players in chat can see *ALIVE* plazma : test
but I'm alive dont see my tag in chat *ALIVE* people *DEAD* and *SPEC* cant see *ALIVE* you understand bro...
__________________
Free Palestine ♥
plazma is offline
plazma
Senior Member
Join Date: Oct 2013
Old 05-18-2014 , 06:19   Re: [REQ] AllChat Tag
Reply With Quote #8

Problem Solved :

format( msg, 199, "%s%s%s%s : %s%s",
is_user_alive(sndr) ? "^x01*ALIVE*" : "",\
strlen( prefix ) > 1 ? prefix : "",\
COLCHAR[namecol], sndr_name, COLCHAR[msgcol], str4 )
return
PLUGIN_HANDLE


I put this [b]^x01is_user_alive(sndr) ? "^x01*ALIVE*" : "",\
__________________
Free Palestine ♥

Last edited by plazma; 05-18-2014 at 06:22.
plazma is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 05-18-2014 , 06:42   Re: [REQ] AllChat Tag
Reply With Quote #9

Yea, thet would work, too. But for code, to look better, maybe it'll be good to use the second method, by adding the prefix.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
plazma
Senior Member
Join Date: Oct 2013
Old 05-18-2014 , 13:00   Re: [REQ] AllChat Tag
Reply With Quote #10

Its not good, he is Restart my server where is the problem??
__________________
Free Palestine ♥
plazma 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 09:41.


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