Raised This Month: $32 Target: $400
 8% 

acronym


Post New Thread Reply   
 
Thread Tools Display Modes
SHIFT0
Senior Member
Join Date: Apr 2021
Location: Palestine
Old 12-16-2021 , 04:22   Re: acronym
Reply With Quote #11

Quote:
Originally Posted by Celena Luna View Post
Copying from this

PHP Code:
#include <amxmodx>

#define MAX_SAY_TEXT_LEN 128
#define MAX_KEYWORD_LEN 32
#define MAX_HIGHLIGHT_LEN 32

enum Match
{
    
Keyword[MAX_KEYWORD_LEN],
    
Highlight[MAX_HIGHLIGHT_LEN]
};

new 
g_ChatKeywords[][Match] =
{
    {
"gg""^4Good Game !"}, //^1 is yellow color | ^3 is team color | ^4 is green color
    
{"slm""^4Slam Alikom"}
};

public 
plugin_init()
{
    
register_clcmd("say""@OnCmd_Say");
}

@
OnCmd_Say(id)
{
    new 
szText[MAX_SAY_TEXT_LEN];
    
read_args(szTextcharsmax(szText));

    
remove_quotes(szText);
    
trim(szText);

    if (!
szText[0])
        return 
PLUGIN_CONTINUE;

    for (new 
iPattern 0szHighlight[MAX_HIGHLIGHT_LEN], iPatterns sizeof(g_ChatKeywords); iPattern iPatternsiPattern++)
    {
        if (
containi(szTextg_ChatKeywords[iPattern][Keyword]) == -1)
            continue;

        
format(szHighlightcharsmax(szHighlight), "%s^1"g_ChatKeywords[iPattern][Highlight]);
        
replace_all(szTextcharsmax(szText), g_ChatKeywords[iPattern][Keyword], szHighlight);
    }

    
// %n was added on 1.9, but it directly parses a certain client's name.
    
client_print_color(0id"^3%n%s^1: %s"idis_user_alive(id) ? "" " ^1*(DEAD)*^1"szText);
    return 
PLUGIN_HANDLED;

You should be able to add the rest

I did like this and has compiled

Quote:
client_print(0, id, "^3%n%s^1: %s", id, is_user_alive(id) ? "" : " ^1*(DEAD)*^1", szText);
__________________
Thank You For Helps
Discord:
null.#0096
https://www.youtube.com/@NullHere/
SHIFT0 is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 12-16-2021 , 04:36   Re: acronym
Reply With Quote #12

oh, you are using 1.8.2
updated post #9

Quote:
Originally Posted by SHIFT0 View Post
I did like this and has compiled
that won't give you chat color
__________________
My plugin:

Last edited by Celena Luna; 12-16-2021 at 04:37.
Celena Luna is offline
SHIFT0
Senior Member
Join Date: Apr 2021
Location: Palestine
Old 12-16-2021 , 04:39   Re: acronym
Reply With Quote #13

Quote:
Originally Posted by Celena Luna View Post
oh, you are using 1.8.2
updated post #9



that won't give you chat color
Alright Ty
__________________
Thank You For Helps
Discord:
null.#0096
https://www.youtube.com/@NullHere/

Last edited by SHIFT0; 12-16-2021 at 04:41. Reason: fixed
SHIFT0 is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 12-16-2021 , 07:20   Re: acronym
Reply With Quote #14

Quote:
Originally Posted by Celena Luna View Post
Copying from this

You should be able to add the rest

Code:
ColorChat(0, "!x04%n%s!x01: %s", id, is_user_alive(id) ? "" : " !x01*(DEAD)*!x01", szText);
You forgot to redo %n to 1.8.2.

And...

Code:
stock ColorChat(const id, const input[], any:...) {
    new count = 1, players[32];
    static msg[191];
    vformat(msg, 190, input, 3);
    
    replace_all(msg, 190, "!x04", "^4");
    replace_all(msg, 190, "!x03", "^3");
    
    if(id) players[0] = id;
    else get_players(players, count, "ch"); {
        for(new i = 0; i < count; i++) {
            if(is_user_connected(players[i])) {
                message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, players[i]);
                write_byte(players[i]);
                write_string(msg);
                message_end();
            }
        }
    }
}


Code:
stock ColorChat(const id, const input[], any:...) {
    new count = 1, players[32];
    static msg[191];
    vformat(msg, 190, input, 3);
    
    replace_all(msg, 190, "!x04", "^4");
    replace_all(msg, 190, "!x03", "^3");
    replace_all(msg, 190, "!x01", "^1");
    
    if(id) players[0] = id;
    else get_players(players, count, "ch"); {
        for(new i = 0; i < count; i++) {
            if(is_user_connected(players[i])) {
                message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, players[i]);
                write_byte(players[i]);
                write_string(msg);
                message_end();
            }
        }
    }
}
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/

Last edited by iceeedr; 12-16-2021 at 07:27.
iceeedr is offline
Send a message via Skype™ to iceeedr
SHIFT0
Senior Member
Join Date: Apr 2021
Location: Palestine
Old 12-16-2021 , 07:59   Re: acronym
Reply With Quote #15

Quote:
Originally Posted by iceeedr View Post
Code:
ColorChat(0, "!x04%n%s!x01: %s", id, is_user_alive(id) ? "" : " !x01*(DEAD)*!x01", szText);
You forgot to redo %n to 1.8.2.

And...

Code:
stock ColorChat(const id, const input[], any:...) {
    new count = 1, players[32];
    static msg[191];
    vformat(msg, 190, input, 3);
    
    replace_all(msg, 190, "!x04", "^4");
    replace_all(msg, 190, "!x03", "^3");
    
    if(id) players[0] = id;
    else get_players(players, count, "ch"); {
        for(new i = 0; i < count; i++) {
            if(is_user_connected(players[i])) {
                message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, players[i]);
                write_byte(players[i]);
                write_string(msg);
                message_end();
            }
        }
    }
}


Code:
stock ColorChat(const id, const input[], any:...) {
    new count = 1, players[32];
    static msg[191];
    vformat(msg, 190, input, 3);
    
    replace_all(msg, 190, "!x04", "^4");
    replace_all(msg, 190, "!x03", "^3");
    replace_all(msg, 190, "!x01", "^1");
    
    if(id) players[0] = id;
    else get_players(players, count, "ch"); {
        for(new i = 0; i < count; i++) {
            if(is_user_connected(players[i])) {
                message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, players[i]);
                write_byte(players[i]);
                write_string(msg);
                message_end();
            }
        }
    }
}
That was doesnt work xd
__________________
Thank You For Helps
Discord:
null.#0096
https://www.youtube.com/@NullHere/
SHIFT0 is offline
SHIFT0
Senior Member
Join Date: Apr 2021
Location: Palestine
Old 12-16-2021 , 13:16   Re: acronym
Reply With Quote #16

Quote:
Originally Posted by iceeedr View Post
Code:
ColorChat(0, "!x04%n%s!x01: %s", id, is_user_alive(id) ? "" : " !x01*(DEAD)*!x01", szText);
You forgot to redo %n to 1.8.2.

And...

Code:
stock ColorChat(const id, const input[], any:...) {
    new count = 1, players[32];
    static msg[191];
    vformat(msg, 190, input, 3);
    
    replace_all(msg, 190, "!x04", "^4");
    replace_all(msg, 190, "!x03", "^3");
    
    if(id) players[0] = id;
    else get_players(players, count, "ch"); {
        for(new i = 0; i < count; i++) {
            if(is_user_connected(players[i])) {
                message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, players[i]);
                write_byte(players[i]);
                write_string(msg);
                message_end();
            }
        }
    }
}


Code:
stock ColorChat(const id, const input[], any:...) {
    new count = 1, players[32];
    static msg[191];
    vformat(msg, 190, input, 3);
    
    replace_all(msg, 190, "!x04", "^4");
    replace_all(msg, 190, "!x03", "^3");
    replace_all(msg, 190, "!x01", "^1");
    
    if(id) players[0] = id;
    else get_players(players, count, "ch"); {
        for(new i = 0; i < count; i++) {
            if(is_user_connected(players[i])) {
                message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, players[i]);
                write_byte(players[i]);
                write_string(msg);
                message_end();
            }
        }
    }
}
https://ibb.co/t4D68VD
Bug
and all saying like this
!x04%s: !x01
wtf ??
__________________
Thank You For Helps
Discord:
null.#0096
https://www.youtube.com/@NullHere/
SHIFT0 is offline
iclassdon
AlliedModders Donor
Join Date: May 2006
Old 12-16-2021 , 18:19   Re: acronym
Reply With Quote #17

Quote:
Originally Posted by iclassdon View Post
Give this a try, will need some editing. If not search for word replacement.

https://forums.alliedmods.net/showpo...79&postcount=7

This code is bugged. After testing it disables all other triggers from server.
iclassdon is offline
Send a message via MSN to iclassdon
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 12-16-2021 , 21:13   Re: acronym
Reply With Quote #18

Quote:
Originally Posted by iceeedr View Post
Code:
ColorChat(0, "!x04%n%s!x01: %s", id, is_user_alive(id) ? "" : " !x01*(DEAD)*!x01", szText);
You forgot to redo %n to 1.8.2.

And replacing !x01
Thanks for pointing that out

@SHIFT0 Another try
- %n fix

#Update 1:
- Forgot to remove id in Color Chat

#Update 2:
- Adding a variable to check to not break any trigger.

#Update 3
- Making player name back to team color

PHP Code:
#include <amxmodx>

#define MAX_SAY_TEXT_LEN 128
#define MAX_KEYWORD_LEN 32
#define MAX_HIGHLIGHT_LEN 32

enum Match
{
    
Keyword[MAX_KEYWORD_LEN],
    
Highlight[MAX_HIGHLIGHT_LEN]
};

new 
g_ChatKeywords[][Match] =
{
    {
"gg""!x04Good Game !"}, //!x01 is yellow color | !x03 is team color | !x04 is green color
    
{"slm""!x04Slam Alikom"}
};

new 
g_msgSayText;

public 
plugin_init()
{
    
register_clcmd("say""@OnCmd_Say");
    
g_msgSayText get_user_msgid("SayText")
}

@
OnCmd_Say(id)
{
    new 
szText[MAX_SAY_TEXT_LEN];
    new 
HasAcronym;
    
read_args(szTextcharsmax(szText));

    
remove_quotes(szText);
    
trim(szText);

    if (!
szText[0])
        return 
PLUGIN_CONTINUE;

    for (new 
iPattern 0szHighlight[MAX_HIGHLIGHT_LEN], iPatterns sizeof(g_ChatKeywords); iPattern iPatternsiPattern++)
    {
        if (
containi(szTextg_ChatKeywords[iPattern][Keyword]) == -1)
            continue;

        if(!
HasAcronymHasAcronym 1

        format
(szHighlightcharsmax(szHighlight), "%s^1"g_ChatKeywords[iPattern][Highlight]);
        
replace_all(szTextcharsmax(szText), g_ChatKeywords[iPattern][Keyword], szHighlight);
    }

    if(!
HasAcronym)
        return 
PLUGIN_CONTINUE
        
    
// %n was added on 1.9, but it directly parses a certain client's name.
    
new szName[64]
    
get_user_name(idszNamecharsmax(szName))
    
ColorChat(0"!x03%s%s!x01: %s"szNameis_user_alive(id) ? "" " !x01*(DEAD)*!x01"szText);
    return 
PLUGIN_HANDLED;

    
stock ColorChat(const id, const input[], any:...) {
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg190input3);
    
    
replace_all(msg190"!x04""^4");
    
replace_all(msg190"!x03""^3");
    
replace_all(msg190"!x01""^1");
    
    if(
idplayers[0] = id;
    else 
get_players(playerscount"ch"); {
        for(new 
0counti++) {
            if(
is_user_connected(players[i])) {
                
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_players[i]);
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }

__________________
My plugin:

Last edited by Celena Luna; 12-17-2021 at 04:51. Reason: iceeedr's and iclassdon's pointed out. Updated #3
Celena Luna is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 12-16-2021 , 21:18   Re: acronym
Reply With Quote #19

Quote:
Originally Posted by Celena Luna View Post
Thanks for pointing that out

PHP Code:
ColorChat(0"!x04%s%s!x01: %s"idszNameis_user_alive(id) ? "" " !x01*(DEAD)*!x01"szText); 


PHP Code:
ColorChat(0"!x04%s%s!x01: %s"szNameis_user_alive(id) ? "" " !x01*(DEAD)*!x01"szText); 
You forgot to delete the variable id
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/

Last edited by iceeedr; 12-16-2021 at 21:18.
iceeedr is offline
Send a message via Skype™ to iceeedr
iclassdon
AlliedModders Donor
Join Date: May 2006
Old 12-17-2021 , 00:37   Re: acronym
Reply With Quote #20

Quote:
Originally Posted by Celena Luna View Post
Thanks for pointing that out

@SHIFT0 Another try
- Making player name back to team color
- %n fix
PHP Code:
#include <amxmodx>

#define MAX_SAY_TEXT_LEN 128
#define MAX_KEYWORD_LEN 32
#define MAX_HIGHLIGHT_LEN 32

enum Match
{
    
Keyword[MAX_KEYWORD_LEN],
    
Highlight[MAX_HIGHLIGHT_LEN]
};

new 
g_ChatKeywords[][Match] =
{
    {
"gg""!x04Good Game !"}, //!x01 is yellow color | !x03 is team color | !x04 is green color
    
{"slm""!x04Slam Alikom"}
};

new 
g_msgSayText;

public 
plugin_init()
{
    
register_clcmd("say""@OnCmd_Say");
    
g_msgSayText get_user_msgid("SayText")
}

@
OnCmd_Say(id)
{
    new 
szText[MAX_SAY_TEXT_LEN];
    
read_args(szTextcharsmax(szText));

    
remove_quotes(szText);
    
trim(szText);

    if (!
szText[0])
        return 
PLUGIN_CONTINUE;

    for (new 
iPattern 0szHighlight[MAX_HIGHLIGHT_LEN], iPatterns sizeof(g_ChatKeywords); iPattern iPatternsiPattern++)
    {
        if (
containi(szTextg_ChatKeywords[iPattern][Keyword]) == -1)
            continue;

        
format(szHighlightcharsmax(szHighlight), "%s^1"g_ChatKeywords[iPattern][Highlight]);
        
replace_all(szTextcharsmax(szText), g_ChatKeywords[iPattern][Keyword], szHighlight);
    }

    
// %n was added on 1.9, but it directly parses a certain client's name.
    
new szName[64]
    
get_user_name(idszNamecharsmax(szName))
    
ColorChat(0"!x03%s%s!x01: %s"szNameis_user_alive(id) ? "" " !x01*(DEAD)*!x01"szText);
    return 
PLUGIN_HANDLED;


stock ColorChat(const id, const input[], any:...) {
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg190input3);
    
    
replace_all(msg190"!x04""^4");
    
replace_all(msg190"!x03""^3");
    
replace_all(msg190"!x01""^1");
    
    if(
idplayers[0] = id;
    else 
get_players(playerscount"ch"); {
        for(new 
0counti++) {
            if(
is_user_connected(players[i])) {
                
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_players[i]);
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }

This one also disables chat triggers "/" <~~~

Think this plug is a great idea.
iclassdon is offline
Send a message via MSN to iclassdon
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 10:37.


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