else if statements help
#1

No matter what I change, and no matter what rank I am on irc, voice, op, halfop, etc it doesn't put the rank. For example, even if I have voice, it doesnt add the "Staff Member on IRC", it just says "%s on IRC says: %s". The rank won't be put in front of the name.
Код:
IRCCMD:say(botid, channel[], user[], host[], params[])
{
    if (!isnull(params))
    {
        new msg[128];
        format(msg, sizeof(msg), "02*** %s on IRC: %s", user, params);
        IRC_GroupSay(groupID, channel, msg);
        format(msg, sizeof(msg), "*** %s on IRC: %s", user, params);
        SendClientMessageToAll(0x00CCCCFF, msg);
    }
    else
    {
        if(IRC_IsVoice(botid, channel, user))
        {
            if(!isnull(params))
            {
                new msg[128];
                format(msg, sizeof(msg), "11Staff Member %s on IRC: %s", user, params);
                IRC_GroupSay(groupID, channel, msg);
                format(msg, sizeof(msg), "Staff Member %s on IRC: %s", user, params);
                SendClientMessageToAll(0x00CCCCFF, msg);
                return 1;
            }
        }
        if (IRC_IsOp(botid, channel, user))
        {
            // Check if the user entered any text
            if (!isnull(params))
            {
                new msg[128];
                format(msg, sizeof(msg), "12Supervisor %s on IRC: %s", user, params);
                IRC_GroupSay(groupID, channel, msg);
                format(msg, sizeof(msg), "Supervisor %s on IRC: %s", user, params);
                SendClientMessageToAll(0x00CCCCFF, msg);
                return 1;
            }
        }
        if (IRC_IsAdmin(botid, channel, user))
        {
        // Check if the user entered any text
            if (!isnull(params))
            {
                new msg[128];
                format(msg, sizeof(msg), "12Asst. Manager %s on IRC: %s", user, params);
                IRC_GroupSay(groupID, channel, msg);
                format(msg, sizeof(msg), "Asst. Manager %s on IRC: %s", user, params);
                SendClientMessageToAll(0x00CCCCFF, msg);
                return 1;
            }
        }
        if (IRC_IsOwner(botid, channel, user))
        {
            // Check if the user entered any text
            if (!isnull(params))
            {
                new msg[128];
                // Echo the formatted message
                format(msg, sizeof(msg), "12Owner %s on IRC: %s", user, params);
                IRC_GroupSay(groupID, channel, msg);
                format(msg, sizeof(msg), "Owner %s on IRC: %s", user, params);
                SendClientMessageToAll(0x00CCCCFF, msg);
                return 1;
            }
        }
    }
    return 1;
}
Reply
#2

You've put an "else" for condition to check if the parameter is a null string or not. So basically, it checks if a person has any status only if they've input nothing. You should always consider doing top to bottom permission checks here so that if a user doesn't have any other privileges, it would just display as normal. I'm also adding that you don't need SendClientMessageToAll and IRC_GroupSay on each and every if statements. You can declare the "msg" array at the very beginning after checking if it's not null and the message display functions at the end, before return statement.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)