AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED]Admin chat function problems again. (https://forums.alliedmods.net/showthread.php?t=163538)

GarbageBox 07-31-2011 13:05

[SOLVED]Admin chat function problems again.
 
I felt confused about my code which highlighted in red color.
As I won't use adminchat.amxx but I still want to use the ADMIN channel function, so I put it in my code, but it seems doesn't work correctly.
If I don't have any flags, I can't see what I said.
But the admin who has chat flags can see.
Code:

public cmdHookSayTeam(id)
{
        new iMessages[192];
        read_args(iMessages, 191);
        remove_quotes(iMessages);       
       
        get_user_name(id, iUserName, 31);
       
        if(iMessages[0] != '@')
        {
                static player;
               
                for(player = 1; player <= gMaxplayers; player++)
                {
                        //...
                }
        }
        else
        {
                if(get_user_flags(id) & ADMIN_ADMIN)
                        iTag = "(ADMIN)"
                else
                        iTag = "(PLAYER)"
               
                new iPlayers[32], iNum;
                get_players(iPlayers, iNum, "ch");
               
                for(new i = 0; i < iNum; i++)
                {
                        if(get_user_flags(iPlayers[i]) & ADMIN_CHAT)
                        {
                                client_color(iPlayers[i], id, "^x04%s ^x03%s ^x01: %s", iTag, iUserName, iMessages[1]);
                        }
                        else if(!is_user_admin(iPlayers[i]))
                        {
                                client_color(iPlayers[i], id, "^x04%s ^x03%s ^x01: %s", iTag, iUserName, iMessages[1]);
                        }
                }

        }
        return PLUGIN_HANDLED;
}


fysiks 07-31-2011 16:12

Re: Admin chat function problems again.
 
:arrow:

PHP Code:

    for(new 0iNumi++)
    {
        if(
get_user_flags(iPlayers[i]) & ADMIN_CHAT && id != iPlayers[i])
        {
            
client_color(iPlayers[i], id"^x04%s ^x03%s ^x01: %s"iTagiUserNameiMessages[1]);
        }
    }
    
client_color(idid"^x04%s ^x03%s ^x01: %s"iTagiUserNameiMessages[1]); 

Your client_color() function is certaintly wrong. Why would the second parameter be "id"? I would recommend this.

GarbageBox 08-01-2011 03:49

Re: [SOLVED]Admin chat function problems again.
 
Thank you again.
BTW, I will try it.


All times are GMT -4. The time now is 03:31.

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