AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Say_team with '@' problem (https://forums.alliedmods.net/showthread.php?t=159903)

GarbageBox 06-23-2011 08:03

Say_team with '@' problem
 
This code is what I made, but it cannot work. What is wrong?
Code:

                if(contain(szText, "@") == 0)
                {
                        if(get_user_flags(id) & ADMIN_ADMIN)
                                szTag = "(ADMIN)"
                        else
                                szTag = "(PLAYER)"
                        format(szMessage, 191, "^x04%s %s ^x01: %s", szTag, szName, szText)
                        client_color(id, id, szMessage);
                }

Also, possible to disable cs console auto repeat what player's said?
As it repeat very slowly and I use other way to repeat it immediately.

fysiks 06-23-2011 15:48

Re: Say_team with '@' problem
 
Show the whole code.

GarbageBox 06-24-2011 03:47

Re: Say_team with '@' problem
 
Code:

#include <amxmodx>

#define PLUGIN        "Replace Admin Chat"
#define VERSION        "1.0"
#define AUTHOR        "CCC"

new szName[32], szTag[24];


public hook_say_team(id)
{
        new szText[192], szMessage[192];
        read_args(szText, 191);
        remove_quotes(szText);
       
        get_user_name(id, szName,31);
        if(contain(szText, "@") == 0)
        {
                if(get_user_flags(id) & ADMIN_ADMIN)
                        szTag = "(ADMIN)"
                else
                        szTag = "(PLAYER)"
                format(szMessage, 191, "^x04%s %s ^x01: %s", szTag, szName, szText)
                client_color(id, id, szMessage);
        }
        return PLUGIN_HANDLED;
}


fysiks 06-24-2011 05:25

Re: Say_team with '@' problem
 
Where is the rest of it?

FiFiX 06-24-2011 05:56

Re: Say_team with '@' problem
 
if(contain(szText, "@")) -> if(equal(szText[0], "@")) ?
Even if(szText[0] == "@") ?

GarbageBox 06-24-2011 06:24

Re: Say_team with '@' problem
 
Code:

#include <amxmodx>

#define PLUGIN        "Replace Admin Chat"
#define VERSION        "1.0"
#define AUTHOR        "CCC"

new szName[32], szTag[24];

public plugin_init()
{
        register_plugin(PLUGIN, VERSION, AUTHOR);
        register_clcmd("say_team", "hook_say_team");
}

public hook_say_team(id)
{
        new szText[192], szMessage[192];
        read_args(szText, 191);
        remove_quotes(szText);
       
        get_user_name(id, szName,31);
       
        new players[32], szPnum[32], tempid;
        get_players(players, szPnum[id]);
        for( new i; i<szPnum[id]; i++)
        {
                tempid = players[i]
               
                new CsTeams:szPlayerTeam = cs_get_user_team(tempid)
                new szTeam[32]
                if (szPlayerTeam == CS_TEAM_T)
                {
                        szTeam = "[TE]"
                }
                else if (szPlayerTeam == CS_TEAM_CT)
                {
                        szTeam = "[CT]"
                }
                else
                {
                        szTeam = "[SPEC]"
                }
               
                if(is_user_alive(id))
                {
                        format(szMessage, 191, "^x03%s %s ^x01: %s", szTeam, szName, szText)
                        client_color(tempid, id, szMessage);
                        client_print(tempid, print_console, "%s %s : %s", szTeam, szName, szText)
                }
                else
                {
                        format(szMessage, 191, "^x01*DEAD* ^x03%s %s ^x01: %s", szTeam, szName, szText)
                        client_color(tempid, id, szMessage);
                        client_print(tempid, print_console, "*DEAD* %s %s : %s", szTeam, szName, szText)
                }
                if(contain(szText, "@") == 0)
                {
                        if(get_user_flags(id) & ADMIN_ADMIN)
                                szTag = "(ADMIN)"
                        else
                                szTag = "(PLAYER)"
                        format(szMessage, 191, "^x04%s %s ^x01: %s", szTag, szName, szText)
                        client_color(id, id, szMessage);
                }
        }
        return PLUGIN_HANDLED;
}

public client_color(playerid, colorid, message[])
{
        message_begin(playerid?MSG_ONE:MSG_ALL, get_user_msgid("SayText"), {0, 0, 0}, playerid)
        write_byte(colorid)
        write_string(message)
        message_end()
}


fysiks 06-25-2011 03:49

Re: Say_team with '@' problem
 
There is one thing wrong with this code and another that may or may not be wrong with your server (but you didn't describe your problem so I cannot tell you for sure!!!!!!!!)


1. No admin normally has the flag ADMIN_ADMIN. This flag is only used by access() and cmd_access() (and other related functions). You should include amxmisc.inc and use is_user_admin(id).
2. You have the original Admin Chat plugin running.

Rant:

We cannot read minds! Everybody who posts on this forum with a problem needs to accurately describe their problem in detail, if you don't you are more than likely wasting our time and yours. It's starting to get very frustrating.


All times are GMT -4. The time now is 23:34.

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