mIRC Homepage
Posted By: PHMinistries whats wrong with this - 22/01/03 08:57 PM
on *:text:!invite*:*:{
if ($nick == isop) { /chatbot invite Chan $2 | /notice $nick $2 Has Been Invited to $Chan | /halt }
}
}

this is a script for a bot that is in any rooms
and what its supposed to do is,
when an op in that room types !invite nick,
it invites them
it should only respond if that person is an op,
can someone tell me whats wrong with this?

thanks
Posted By: Online Re: whats wrong with this - 22/01/03 09:04 PM
Code:
on *:text:!invite *:#:{
  if ($nick isop #) {
    chatbot invite # $2
    notice $nick $2 Has Been Invited to #
  }
}


if ($nick == isop) wasn't the correct operator. see /help if-then-else for syntax info.

Also, your script is listening for !invite in both channel and private. should be channel only, I guess.

Remote commands don't have to be preceded by slash.

Finally, no need for halt as the script already ended.

(edit: is /chatbot an alias which messages your bot, or did you mean /msg chatbot?)
Posted By: The_Game Re: whats wrong with this - 22/01/03 09:16 PM
This works for me

on *:TEXT:*!invite*:#:/invite $2 #Channel | /notice $nick you have invited $2 to #Channel!


Hope it works for you....just add this to your bot it should work

*note when you type !invite include the nick of the person you are inviting
Posted By: PHMinistries Re: whats wrong with this - 22/01/03 09:35 PM
works perfect thanks
Posted By: The_Game Re: whats wrong with this - 22/01/03 09:37 PM
no problem...
Posted By: Aubs Re: whats wrong with this - 23/01/03 03:01 PM
It shouldn't work peoperly, because if you are not an op in that channel, you shouldn't be able to invite anyone (I mean server doesn't let you invite)...Maybe you should use:

Code:
[color:green];You need to be an @op, otherwise it doesn't invite.[/color]
on @*:TEXT:!invite*:#:{
  [color:green];Checks to see if the person typing !invite <nick> is an op[/color]
  if ($nick isop $chan) {
    [color:green];person is an op. Checks to see if the person being invited is already in the channel[/color]
    [color:green];saves sending a command to the server if one isn't needed[/color]
    if ($2 ison $chan) { .notice $nick $2 is already on $chan | halt }
    [color:green];If they are not on the channel, invite them[/color]
    /invite $2 $chan
    .notice $nick Successfully invited $2 into $chan
    halt
  }
  [color:green];If the person typing !invote is not an op, tell them they need to be[/color]
  .notice $nick you must have operator status to invite someone into $chan
  halt
}


Ultimately, if the person typing !invite is an op, they could easilly type: //invite <nick> $active :and the person would be invited!!

Anyways, hope it helps smile
© mIRC Discussion Forums