Hey, I'm currently working on a script and i'm having an issue with an if and else statement.
if ($dinfo(%data.data).action == version) {
sockwrite -n $sockname 1.0.02-07-2003
echo @server_debug $dtime $sock($sockname).ip requested version information
}
if (($dinfo(%data.data).action == voice) && ($numtok(%data.data,32) == 3)) {
if (($me isop $dinfo(%data.data).chan) && ($dinfo(%data.data).nick ison $dinfo(%data.data).chan) && ($dinfo(%data.data).nick isreg $dinfo(%data.data).chan)) {
mode $dinfo(%data.data).chan +v $dinfo(%data.data).nick
sockwrite -n $sockname Success
echo @server_debug $dtime $sock($sockname).ip successfully voiced a user
}
else {
sockwrite -n $sockname VOICE_ERROR
echo @server_debug $dtime $sock($sockname).ip unsuccessfully attempted to voice a user
}
}
else {
sockwrite -n $sockname VOICE_SYNTAX_ERROR
echo @server_debug $dtime $sock($sockname).ip did not specify a correct syntax to voice
}
Currently, the 1st if statement is triggering the 2nd if statement...I know there are ways around it, but I'm just wondering if anyone else has noticed this....
What I know I can do is seperate the 2nd if statement out to another section, and only check for the %data.data = voice, and have it look at the syntax afterwards......
but Im just wondering if anyone else has encountered this issue and maybe has brought it up? It would be nice to have the ability to seperate if and else statements like that..
{
if { }
{
if { }
else { }
}
else { }
}
Alternatively I could use a halt or return but it just doesn't look right to me to do it that way
I think I solved my own problem though, LOL....