AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Help with adminchat (https://forums.alliedmods.net/showthread.php?t=309991)

Rivotril 08-14-2018 22:40

Help with adminchat
 
Hello, i need to remove some symbols from the admin chat (say_team @) of the amx but i don't know how to do that, i need to detect symbols like # and % if the client said that just replace it with nothing, thanks!

Code:

public cmdSayAdmin(id)
{
        new said[2]
        read_argv(1, said, 1)
       
        if (said[0] != '@')
                return PLUGIN_CONTINUE
       
        new message[192], name[32], authid[32], userid
        new players[32], inum
       
        read_args(message, 191)
        remove_quotes(message)
        get_user_authid(id, authid, 31)
        get_user_name(id, name, 31)
        userid = get_user_userid(id)
       
        log_amx("Chat: ^"%s<%d><%s><>^" chat ^"%s^"", name, userid, authid, message[1])
        log_message("^"%s<%d><%s><>^" triggered ^"amx_chat^" (text ^"%s^")", name, userid, authid, message[1])
       
        if (is_user_admin(id))
                format(message, 191, "(%L) %s :  %s", id, "ADMIN", name, message[1])
        else
                format(message, 191, "(%L) %s :  %s", id, "PLAYER", name, message[1])

        get_players(players, inum)
       
        for (new i = 0; i < inum; ++i)
        {
                // dont print the message to the client that used the cmd if he has ADMIN_CHAT to avoid double printing
                if (players[i] != id && get_user_flags(players[i]) & g_AdminChatFlag)
                        client_print(players[i], print_chat, "%s", message)
        }
       
        client_print(id, print_chat, "%s", message)
       
        return PLUGIN_HANDLED
}


fysiks 08-14-2018 23:49

Re: Help with adminchat
 
Use replace_all() to replace characters that you want replaced.

Rivotril 08-15-2018 00:58

Re: Help with adminchat
 
Quote:

Originally Posted by fysiks (Post 2610250)
Use replace_all() to replace characters that you want replaced.

Thanks!


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

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