small problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: small problem (
/showthread.php?tid=389059)
small problem -
Face9000 - 31.10.2012
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?
Re: small problem -
Face9000 - 31.10.2012
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.
Re: small problem -
Stu1 - 31.10.2012
Try use else if's
else if (IRC_IsOp(botid, channel, user))
and
else if (IRC_IsVoice(botid, channel, user))
Re: small problem -
ReneG - 31.10.2012
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.