mIRC Home    About    Download    Register    News    Help

Print Thread
#17876 02/04/03 11:38 PM
Joined: Apr 2003
Posts: 25
S
SS217 Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Apr 2003
Posts: 25
Hey all, I've been working on a script for a game C&C:Renegade, my server reports to the iRC channel and has commands like !kick !rules etc. I want the server to page the user if he types an invaild command, and ignore the commands below. This is the basics

on *:TEXT:*!*:#jtekbot: {
if (!settime) {
if (!kick) {
if (!rules) {
if (!showmods) {
if (!website) {
if (!nextmap) {
if (!qkick) {
if (!allow) {
if (!flyingmaps) {
if (!nodefensemaps) {
if (!defensemaps) {
if (!ctfmaps) {
if (!autorotate) {
if (!vehiclekick) {
if (!vehiclewarn) {
if (!keywordkick) {
if (!keywordwarn) {
if (!showmsg) {
if (!adjustmaxplayers) {
if (!nextmapvotesuccess) {
if (!nextmapvotefail) {
if (!genvotefailed) {
if (!votenextmap) {
if (!voteflyingmaps) {
if (!votedefensemaps) {
if (!votenodefensemaps) {
if (!votectfmaps) {
if (!votekick) {
if (!ban) {
if (!gameover) {
if (!curmap) {
else { msg $chan !page $2 Hey, I'm an automated bot for JTeK Snipe Server number 2, it appears you're having trouble with the "!" commands, please type !help in F2 for a list of active commands. }
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}

Last edited by SS217; 02/04/03 11:38 PM.
Joined: Dec 2002
Posts: 774
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 774
Code:
on *:TEXT:!*:#jtekbot: {
  var %cmds = !settime !kick !rules !showmods !website !nextmap !qkick !allow !flyingmaps !nodefensemaps $&
    !defensemaps !ctfmaps !autorotate !vehiclekick !vehiclewarn !keywordkick !keywordwarn !showmsg $& 
    !adjustmaxplayers !nextmapvotesuccess !nextmapvotefail !genvotefailed !votenextmap !voteflyingmaps $&
    !votedefensemaps !votenodefensemaps !votectfmaps !votekick !ban !gameover !curmap
  if ( !$istok(%cmds,$1,32) ) { 
    msg $chan !page $2 Hey, I'm an automated bot for JTeK Snipe Server number 2, it appears you're having $&
    trouble with the "!" commands, please type !help in F2 for a list of active commands. 
  }
}
  


/help $istok
/help $&

Last edited by theRat; 03/04/03 09:45 AM.

Code:
//if ( khaled isgod ) echo yes | else echo no
Joined: Feb 2003
Posts: 47
G
Ameglian cow
Offline
Ameglian cow
G
Joined: Feb 2003
Posts: 47
You're not evaluating anything in your if-statements (well actually you are but not in the way you want it).

Use the following syntax instead:
Code:
on *:TEXT:!*:#jtekbot:{
  if ($1 == !settime) {
    <code to be performed here>
  }
  if ($1) == !kick) {
    <code to be performed here>
  }
  <rest of if-statements>
}


$1 holds the first space-seperated character set (first word on a line, also called parameters). $2 holds the second parameter. If you specify a - (stripe) after a parameter then it will take the rest of the line starting at that parameter. $2- means parameter 2 untill the end of the line. The event will now only be triggered if there's a line of text starting with a ! since the wildmask is only after the ! and not in front of it as well (like you did).

All this info can be found in the help-file.

Joined: Apr 2003
Posts: 25
S
SS217 Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Apr 2003
Posts: 25
The second one is pretty good, except I want it to ignore !kick !settime etc. However if they type an invalid command like !commands they'd get paged by the server with a list of commands I already have !kick etc defined. It's defined by BR.NET


Link Copied to Clipboard