Raised This Month: $ Target: $400
 0% 

Color Chat problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 10-26-2013 , 07:46   Color Chat problem
Reply With Quote #1

Hi, iam using color chat by connormcleod.
The message isnt displayed, can someone fix it?

PHP Code:
public Hook_Say(id)
{
    if(!
is_user_connected(id))
        return 
PLUGIN_CONTINUE
        
    
static said[190]
    
read_args(saidcharsmax(said))
    
remove_quotes(said)
    
    if(
equal(said"") || containi(said"%s%s%s") != 1)
        return 
PLUGIN_HANDLED
        
    
new name[34], msg[190], prefix[10]
    
get_user_name(idnamecharsmax(name))
    
    if(
Zombie[id])
        
formatex(prefixcharsmax(prefix), "[ZOMBIE]")
    
    else
    {
        if(
Hero[id])
            
formatex(prefixcharsmax(prefix), "[HERO]")
            
        else
            
formatex(prefixcharsmax(prefix), "[HUMAN]")
    }
    
    
formatex(msgcharsmax(msg), "^4%s ^3%s^1: %s"prefixnamesaid)
        
    if(!
is_user_alive(id))
        
formatex(msgcharsmax(msg), "^1*DEAD* %s"msg)
    
    if(
Zombie[id])
        
client_print_color(0RED"%s"msg)
        
    else
        
client_print_color(0BLUE"%s"msg)
    
    return 
PLUGIN_HANDLED

__________________
Jhob94 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-26-2013 , 08:09   Re: Color Chat problem
Reply With Quote #2

Code is correct excepted that line :

PHP Code:
formatex(msgcharsmax(msg), "^1*DEAD* %s"msg
You should use format there instead of formatex.


Anyway, why don't you try amxx 1.8.3 ?
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 10-26-2013 at 08:10.
ConnorMcLeod is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 10-26-2013 , 09:03   Re: Color Chat problem
Reply With Quote #3

Quote:
Originally Posted by ConnorMcLeod View Post
Code is correct excepted that line :

PHP Code:
formatex(msgcharsmax(msg), "^1*DEAD* %s"msg
You should use format there instead of formatex.
Will try, thanks

Quote:
Originally Posted by ConnorMcLeod View Post
Anyway, why don't you try amxx 1.8.3 ?
Isnt oficial version. I only use it in my test server.

EDIT:
It still not showing
__________________

Last edited by Jhob94; 10-26-2013 at 09:10.
Jhob94 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-26-2013 , 09:22   Re: Color Chat problem
Reply With Quote #4

You could shorten code like this though :

PHP Code:
public Hook_Say(id)
{
    static 
said[190];
    
read_args(saidcharsmax(said));
    
remove_quotes(said);

    if( !
said[0] || containi(said"%s%s") != 1)
    {
        return 
PLUGIN_HANDLED;
    }

    new 
name[32];
    
get_user_name(idnamecharsmax(name));

    
client_print_color(0Zombie[id] ? Red Blue"%s^4[%s] ^3%s^1: %s"
                                                    
is_user_alive(id) ? "" "^1*DEAD* "
                                                        
Zombie[id] ? "ZOMBIE" Hero[id] ? "HERO" "HUMAN",
                                                                
name,
                                                                        
said);

    return 
PLUGIN_HANDLED_MAIN// so chat cmds gonna work.

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 10-26-2013 at 09:23.
ConnorMcLeod is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 10-26-2013 , 09:39   Re: Color Chat problem
Reply With Quote #5

Doesnt works too

Edit:
Maybe because iam not really doing as i showed before:
PHP Code:
#define Get_BitVar(%1,%2) (%1 & (1 << (%2 & 31)))
#define Set_BitVar(%1,%2) %1 |= (1 << (%2 & 31))
#define UnSet_BitVar(%1,%2) %1 &= ~(1 << (%2 & 31))

public plugin_init() 
{
    
register_clcmd("say""Hook_Say");
    
register_clcmd("say_team""Hook_Say");
}

public 
Hook_Say(id)
{
    static 
said[190];
    
read_args(saidcharsmax(said));
    
remove_quotes(said);
    
    if(!
said[0] || containi(said"%s%s") != 1)
        return 
PLUGIN_HANDLED;
    
    new 
name[32];
    
get_user_name(idnamecharsmax(name));
    
    
client_print_color(0Get_BitVar(g_IsZombieid) ? Red Blue"%s^4[%s] ^3%s^1: %s"
                                                    
is_user_alive(id) ? "" "^1*DEAD* "
                                                        
Get_BitVar(g_IsZombieid) ? "ZOMBIE" Get_BitVar(g_BecomeHeroid) ? "HERO" "HUMAN",
                                                                
name,
                                                                        
said);
    
    return 
PLUGIN_HANDLED_MAIN// so chat cmds gonna work.

__________________

Last edited by Jhob94; 10-26-2013 at 09:58.
Jhob94 is offline
tonykaram1993
Senior Member
Join Date: Mar 2013
Location: This World
Old 10-26-2013 , 10:19   Re: Color Chat problem
Reply With Quote #6

We need more information. What is not working? The message is not shown at all? Do you get error logs? Are you using version 1.8.3? We can't simply guess what the problem is whithout you giving us some information.
__________________
My Plugins:
UltimatePlugin
UltimateSurf
UltimateAdmin
Code:
rcon version | rcon amxx version | rcon meta version
rcon amxx plugins | rcon meta list | rcon status
I AM INACTIVE ON THIS FORUM - For direct contact: [email protected]
tonykaram1993 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-26-2013 , 11:05   Re: Color Chat problem
Reply With Quote #7

Your error, from the begining you are checking containi against 1 instead of -1

Following code works fine for me :

Note that you can use player index as color.

PHP Code:
#include < amxmodx >

#pragma semicolon 1

#define PLUGIN ""
#define VERSION "0.0.1"

#define cm(%0)    ( sizeof(%0) - 1 )

public plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" );

    
register_clcmd("say""Host_Say"0);
    
register_clcmd("say_team""Host_Say"1);
}

public 
Host_Say(id)
{
    static 
said[190];
    
read_args(saidcharsmax(said));
    
remove_quotes(said);

    if( !
said[0] || containi(said"%s%s") != -)
    {
        return 
PLUGIN_HANDLED;
    }

    new 
name[32];
    
get_user_name(idnamecharsmax(name));
    new 
team get_user_team(id);

    
client_print_color(0id"%s^4[%s] ^3%s^1: %s"
                                                    
is_user_alive(id) ? "" "^1*DEAD* "
                                                        
team == "ZOMBIE" random(2) ? "HERO" "HUMAN",
                                                                
name,
                                                                        
said);

    return 
PLUGIN_HANDLED_MAIN// so chat cmds gonna work.

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 10-26-2013 at 11:07.
ConnorMcLeod is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 10-26-2013 , 11:30   Re: Color Chat problem
Reply With Quote #8

Quote:
Originally Posted by tonykaram1993 View Post
We need more information. What is not working? The message is not shown at all? Do you get error logs? Are you using version 1.8.3? We can't simply guess what the problem is whithout you giving us some information.
my error files has ~500mb and i cant open it for check out what are the errors. The mod isnt mine and since i got it, it has all that errors that i have no idea wich are...

Quote:
Originally Posted by ConnorMcLeod View Post
Your error, from the begining you are checking containi against 1 instead of -1
How i didnt saw that

Quote:
Originally Posted by ConnorMcLeod View Post
Note that you can use player index as color.
I know, but on round start teams are balanced and Humans can be in terro team, thats the why i am doing this way

Thanks both
__________________
Jhob94 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 23:17.


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