How do I make IRC only send Admin chats to Users with Half-OP and above..
#1

Title speaks for itself. How is it possible?

pawn Код:
public OnPlayerText(playerid, text[])
{
    new textstring[128];
    new ircMsg[256];

    if(PlayerInfo[playerid][pMuted] == true)
    {
        SendClientMessage(playerid, -1, "SERVER: You can't talk while muted.");
        return 0;
    }
    if( text[0] == '!')
    {
        // Echo the formatted message
        format(ircMsg, sizeof(ircMsg), "9,4*** %s (ID: %i) to IRC: %s", GetName(playerid), playerid, text[1]);
        IRC_GroupSay(groupID, IRC_CHANNEL, ircMsg);
        format(ircMsg, sizeof(ircMsg), "Your message '%s' has been sent to IRC.", text[1]);
        SendClientMessage(playerid, 0x0000FFFF, ircMsg);
        return 0;
    }
    format(ircMsg, sizeof(ircMsg), "02[%d] 07%s: %s", playerid, GetName(playerid), text);
    IRC_GroupSay(groupID, IRC_CHANNEL, ircMsg);
    if( text[0] == '#' && PlayerInfo[playerid][pAdmin] == 1)
    {
        new Message[128];
        format( Message, sizeof Message, "{00B2EE}[ADMIN CHAT] %s (ID: %i | LVL: %i): %s", GetName(playerid), playerid, PlayerInfo[playerid][pAdmin], text[1] );
        SendAdminMessage(1, -1, Message);
        return 0;
    }
    else if( text[0] == '#' && PlayerInfo[playerid][pAdmin] == 2  )
    {
        new Message[128];
        format( Message, sizeof Message, "{00EE76}[ADMIN CHAT] %s (ID: %i | LVL: %i): %s", GetName(playerid), playerid, PlayerInfo[playerid][pAdmin], text[1] );
        SendAdminMessage(1, -1, Message);
        return 0;
    }
    else if( text[0] == '#' && PlayerInfo[playerid][pAdmin] == 3 )
    {
        new Message[128];
        format( Message, sizeof Message, "{EEEE00}[ADMIN CHAT] %s (ID: %i | LVL: %i): %s", GetName(playerid), playerid, PlayerInfo[playerid][pAdmin], text[1] );
        SendAdminMessage(1, -1, Message);
        return 0;
    }
    else if( text[0] == '#' && PlayerInfo[playerid][pAdmin] == 4 )
    {
        new Message[128];
        format( Message, sizeof Message, "{FF0000}[ADMIN CHAT] %s (ID: %i | LVL: %i): %s", GetName(playerid), playerid, PlayerInfo[playerid][pAdmin], text[1] );
        SendAdminMessage(1, -1, Message);
        return 0;
    }
    else if( text[0] == '#' && PlayerInfo[playerid][pAdmin] >= 5 )
    {
        new Message[128];
        format( Message, sizeof Message, "{FF7F00}[ADMIN CHAT] %s (ID: %i | LVL: %i): %s", GetName(playerid), playerid, PlayerInfo[playerid][pAdmin], text[1] );
        SendAdminMessage(1, -1, Message);
        return 0;
    }
    if( text[0] == '@' && PlayerInfo[playerid][pVip] == 1 )
    {
        new Message[128];
        format( Message, sizeof Message, "{C0C0C0}[VIP CHAT] %s (ID: %i | LVL: %i): %s", GetName(playerid), playerid, PlayerInfo[playerid][pVip], text[1] );
        SendVIPMessage(1, -2, Message);
        return 0;
    }
    else if( text[0] == '@' && PlayerInfo[playerid][pVip] == 2 )
    {
        new Message[128];
        format( Message, sizeof Message, "{C0C0C0}[VIP CHAT] %s (ID: %i | LVL: %i): %s", GetName(playerid), playerid, PlayerInfo[playerid][pVip], text[1] );
        SendVIPMessage(1, -2, Message);
        return 0;
    }
    else if( text[0] == '@' && PlayerInfo[playerid][pVip] == 3 )
    {
        new Message[128];
        format( Message, sizeof Message, "{FFD700}[VIP CHAT] %s (ID: %i | LVL: %i): %s", GetName(playerid), playerid, PlayerInfo[playerid][pVip], text[1] );
        SendVIPMessage(1, -2, Message);
        return 0;
}
    return 1;
}
Reply
#2

What is the IRC Channel? I can help you once you tell me it.

Usually it's somethingl ike this though:
pawn Код:
IRC_GroupSay(groupID, "%#IRCCHANNELHERE", ircMsg);
The "%" sign sends messages to all halfops and above.
Reply
#3

wcgsamp
Reply
#4

Quote:
Originally Posted by dr.pepper
Посмотреть сообщение
What is the IRC Channel? I can help you once you tell me it.

Usually it's somethingl ike this though:
pawn Код:
IRC_GroupSay(groupID, "%#IRCCHANNELHERE", ircMsg);
The "%" sign sends messages to all halfops and above.
So then it's like this:

pawn Код:
IRC_GroupSay(groupID, "%#wcgsamp", ircMsg);
Reply
#5

Quote:
Originally Posted by dr.pepper
Посмотреть сообщение
So then it's like this:

pawn Код:
IRC_GroupSay(groupID, "%#wcgsamp", ircMsg);
Does it matter if it's defined?

#define IRC_CHANNEL "wcgsamp"
Reply
#6

Usually you need the quotes "" and would need the full channel name instead of IRC_CHANNEL. IRC_CHANNEL is a define so if you used "%IRC_CHANNEL" it would try to send messages to the actual channel "#IRC_CHANNEL" which is not valid because you are using #wcgsamp.

I am sorry if I did not explain well enough. When you are just sending messages to a channel IRC_CHANNEL is fine without the quotations "'.
Reply
#7

I did it, but it doesn't work, it still shows even when I'm not a halfop.

Код:
<@WCG1> [JOINED] [MM]HydraX (ID: 0)
<@WCG2> ***[MM]HydraX (ID: 0) has logged on to his account.
<@WCG1> [0] [MM]HydraX: #test
pawn Код:
format(ircMsg, sizeof(ircMsg), "02[%d] 07%s: %s", playerid, GetName(playerid), text);
    IRC_GroupSay(groupID, IRC_CHANNEL, ircMsg);
    if( text[0] == '#' && PlayerInfo[playerid][pAdmin] == 1)
    {
        new Message[128];
        format( Message, sizeof Message, "{00B2EE}[ADMIN CHAT] %s (ID: %i | LVL: %i): %s", GetName(playerid), playerid, PlayerInfo[playerid][pAdmin], text[1] );
        SendAdminMessage(1, -1, Message);
        IRC_GroupSay(groupID, "%#wcgsamp", Message);
        return 0;
    }
Reply
#8

Are you sure you are logged in IRC as a halfop or above?
Reply
#9

Quote:
Originally Posted by dr.pepper
Посмотреть сообщение
Are you sure you are logged in IRC as a halfop or above?
No, I'm testing it to see if it shows when you aren't halfop or above.
I don't want it to show the admin chat when you are just a regular user in IRC, I want it to show only when you are halfop or higher.
Reply
#10

Oh and shouldn't the callback OnPlayerText return 0; so this doesn't appear in IRC:
<@WCG1> [0] [MM]HydraX: #test

I'm just wondering because #test shouldn't be visible from IRC Chat?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)