small problem
#1

Hello, im making order in my irc admin commands and i have a problem with this:

pawn Код:
IRCCMD:acmds(botid, channel[], user[], host[], params[])
{
    if (IRC_IsHalfop(botid, channel, user))
    {
    IRC_Notice(gGroupID,user,"IRC ADMIN COMMANDS");
    IRC_Notice(gGroupID,user,"Admin commands: !kick - !ban - !rcon - !announce - !freeze - !unfreeze - !explode - !mute - !unmute - !ip - !a - !money - !sall - !score - !banip - !unbanip - !hparm - !hostname - !mapname - !clearchat - !drop - !last - !serverstats - !gmx - !getweps - !stats - !warn - !ping - !setvip - !setlevel");
    }
   
    if (IRC_IsOp(botid, channel, user))
    {
    IRC_Notice(gGroupID,user,"IRC ADMIN COMMANDS");
    IRC_Notice(gGroupID,user,"Admin commands: !kick - !ban - !rcon - !announce - !freeze - !unfreeze - !explode");
    }
   
    if (IRC_IsVoice(botid, channel, user))
    {
    IRC_Notice(gGroupID,user,"For players command, type !cmds");
    }
    return 1;
}
Problem:

For normal irc user it doesnt work that command, for who have halfop, op, voice, sop etc it sends all the 3 messages.

How to fix it?
Reply
#2

Sorry ****** but after a day full of work don't you think i'm allowed to ask even a little help?

Don't be rude please, i have nothing against you but please don't post if you're not going to help me.

I know how to debug, i just stucked with this little problem because i never worked with IRC.
Reply
#3

Try use else if's

else if (IRC_IsOp(botid, channel, user))
and
else if (IRC_IsVoice(botid, channel, user))
Reply
#4

Try
pawn Код:
IRCCMD:acmds(botid, channel[], user[], host[], params[])
{
    if (IRC_IsHalfop(botid, channel, user))
    {
        IRC_Notice(gGroupID,user,"IRC ADMIN COMMANDS");
        IRC_Notice(gGroupID,user,"Admin commands: !kick - !ban - !rcon - !announce - !freeze - !unfreeze - !explode - !mute - !unmute - !ip - !a - !money - !sall - !score - !banip - !unbanip - !hparm - !hostname - !mapname - !clearchat - !drop - !last - !serverstats - !gmx - !getweps - !stats - !warn - !ping - !setvip - !setlevel");
        return 1; // if the user is a half op, then you can return here to stop the command from going on and sending the rest of the messages
    }
   
    if (IRC_IsOp(botid, channel, user))
    {
        IRC_Notice(gGroupID,user,"IRC ADMIN COMMANDS");
        IRC_Notice(gGroupID,user,"Admin commands: !kick - !ban - !rcon - !announce - !freeze - !unfreeze - !explode");
        return 1; // same thing
    }
   
    if (IRC_IsVoice(botid, channel, user))
    {
        IRC_Notice(gGroupID,user,"For players command, type !cmds"); // you don't need to return here since the command will return 1 below automatically if the user isn't "voice"
    }
    return 1;
}
You just need to understand the basics of program flow.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)