mIRC Homepage
Posted By: MrPeepers On join /part - 22/09/03 05:15 AM
Me and a friend run a small irc server, when i goto bed he likes to be an ass and force me into rooms with odd names, i wrote a lil script that if the channel doesnt match a variable it parts but it doesnt work help would be apreciated
Code:
 
on *:join:#: {
  if ($chan != %chans)
  /part
}
 

And I set the variable by hand and checked to make sure it was what it was supposed to be
Posted By: LocutusofBorg Re: On join /part - 22/09/03 05:24 AM
And you think he won't be able to circumvent that? Why not simply use mirc's password feature? (type /help lock)

PS: a good ass-kicking might be helpful too, as well as a redefinition of the word "friend"
Posted By: pheonix Re: On join /part - 22/09/03 05:26 AM
alias join {
join $2
.set -u3 %joined $true
}
on *:JOIN:#:{
if (!%joined) || (%joined != $true) { part $chan }
}
Posted By: pheonix Re: On join /part - 22/09/03 05:29 AM
Quote:
as well as a redefinition of the word "friend"

yeah i never thought friends should mess around either
[/sarcasm]
Posted By: MrPeepers Re: On join /part - 22/09/03 05:30 AM
the lock feature sure seems like it would work since he isnt on my computer, why dont you read it and maybe learn a thing or two. And thankyou pheonix
Posted By: pheonix Re: On join /part - 22/09/03 05:31 AM
np:), that might not work if your on a really laggy irc server, or if you have a really slow internet connection.
in other words, if it takes you longer than 3 seconds to /join it will /part.
Posted By: cold Re: On join /part - 22/09/03 05:47 AM
[edit: removed the lock suggestion]
It would be something like these..
Code:
[color:brown]on *:join:#:{ if ($nick == $me) && ($istok(%chans,$chan,32)) { part } }[/color]
or
[color:brown]on me:*:join:#:{ if ($istok(%chans,$chan,32)) { part } }[/color]

You'd fill %chans with "#channel1 #channel2 #channel3 ... #channelN".

Your current script fails because..
1) Your /if statement doesn't check if $chan is an existing item from the list on %chans. Instead, it checks if $chan is different (!=) than the whole list on %chans, which doesn't make sense;
2) Your /part command is not part of the /if statement (no { } brackets nor both sentences in the same line), causing the script to always leave any channel you join.
Posted By: cold Re: On join /part - 22/09/03 05:59 AM
I don't get it, why /part if it takes 3s or more? The only problem I saw was about channel names.

Anyway, that would be "join $1-", not "$2".
Also a tip, the condition "(!%joined) || (%joined != $true)" is redundant, it can be shortened to "(!%joined)".
Posted By: pheonix Re: On join /part - 22/09/03 11:41 AM
no it cant, because then the /join alias will be useless, the whole point of setting the variable '%joined' to '$true' is so that if someone /fjoins him it will /part.
i realise it should of been $1 blush
Posted By: Sigh Re: On join /part - 22/09/03 01:12 PM
Don't you receive a specific server notice when the fjoin command is used? Scripting something that reacts to that may be another option (using the on snotice event).
Posted By: Watchdog Re: On join /part - 22/09/03 03:41 PM
That will stop mIRC opening the window but /fjoin will still bring you to a room. It's not possible to get around. I think a review of the fella's o:line is in order.
Posted By: r0ck0 Re: On join /part - 22/09/03 04:02 PM
Code:
alias join {
  set [color:red]-u10[/color] $+($eval(%joined,0),.,[color:green]$iif($left($1,1) == -,$2,$1)[/color]) $true
  !join $1-
}

on *:JOIN:#: {
  if (($nick == $me) && (!$eval($+($eval(%joined,0),.,#),2))) !part #
  unset $+($eval(%joined,0),.,#)
}


[i]Edit:

Added this to unset variable in case of no join (ban, invite only, incorrect
key, channel limit etc.) and 10 seconds to allow for some lag time.


Added this in case switches are used with the JOIN command
Posted By: r0ck0 Re: On join /part - 22/09/03 06:08 PM
hmmm edit time ran out lol .. forget my last reply
Code:
alias join {
  var %chans = $iif($left($1,1) == -,$2,$1),%i = 1
  while ($gettok(%chans,%i,44) != $null) {
    set -u10 $+($eval(%joined,0),.,$gettok(%chans,%i,44)) $true
    inc %i
  }
  !join $1-
}
on *:JOIN:#: {
  if (($nick == $me) && (!$eval($+($eval(%joined,0),.,#),2))) !part #
  unset $+($eval(%joined,0),.,#)
}
Posted By: cold Re: On join /part - 22/09/03 08:22 PM
Quote:
no it cant, because then the /join alias will be useless, the whole point of setting the variable '%joined' to '$true' is so that if someone /fjoins him it will /part.

"(!%joined) || (%joined != $true)" means "(%joined is $null, $false or 0) OR (%joined isn't $true)".

If %joined isn't $true, then it will satisfy the first condition. Since your whole code doesn't tell %joined to be something other than $true or $null anywhere, this condition will be evaluated to "(!$null)", which is always satisfied.
Otherwise, if %joined is $true, it will be evaluated to "(!$true)", thus won't be satisfied.

So, that means the first condition itself checks everything. No need for the second one, it's redundant in this case. That's what I meant.
Posted By: LocutusofBorg Re: On join /part - 22/09/03 08:29 PM
I assume it's a stab at my help suggestion. Your original post made it quite obvious he was using YOUR mirc ( that is to say - you never specified he wasn't using your mirc copy, you now seem to say he uses another mirc copy on another computer )? In that case, he someone remotely controls your mirc? ewww. remove the script then.
Posted By: r0ck0 Re: On join /part - 22/09/03 08:43 PM
Some IRCd's like Hybrid have a Force Join module that gives admins a command called FORCEJOIN or FJOIN which forces a user to join a channel.

/forcejoin <nick> <channel>
/fjoin <nick> <channel>
Posted By: Watchdog Re: On join /part - 22/09/03 08:50 PM
/sajoin is for opers to use on themselves and provides ban protection.
/fjoin is for opers to use on other users but only provides a forced entry but no protection.
Posted By: r0ck0 Re: On join /part - 22/09/03 09:12 PM
ya that's right .. was it SVSJOIN?

I think this is from Unreal ..
SVSJOIN
Forces a user to join a channel. Can only be used by a U:Lined server.
Syntax: /SVSJOIN [nickname] [channel]
Example: /SVSJOIN parseint #perch

SAJOIN
Forces a user to join a channel. Can only be used by a Services Admin.
Syntax: /SAJOIN [nickname] [channel]
Example: /SAJOIN parseint #perch

SVSPART
Forces a user to leave a channel. Can only be used by a U:Lined server.
Syntax: /SVSPART [nickname] [channel]
Example: /SVSPART parseint #perch

SAPART
Forces a user to leave a channel. Can only be used by a Services Admin.
Syntax: /SAPART [nickname] [channel]
Example: /SAPART parseint #perch

Anyway, LocutusofBorg it sounds like this is what he meant.
It's what I assumed he meant anyway.
Posted By: codemastr Re: On join /part - 22/09/03 11:06 PM
In UnrealIRCd /sajoin is _not_ what Watchdog said. It allows you to force someone else to join a channel. The thing is, the user will be notified with a message like "someoper forced you to join #somechannel." svsjoin, which can only be used by services does not display that notice. The reason is, many IRC services programs have an autojoin feature. Basically a server-side autojoin list. They make use of SVSJOIN to accomplish that. It would be a pain if each time you connected and /ns identified that you'd get "nickserv forced you to join #thechannel."
Posted By: r0ck0 Re: On join /part - 22/09/03 11:33 PM
thx smile
© mIRC Discussion Forums