This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Var probs..

Old posts that have not been replied to for several years.
f
feroz
Voice
Posts: 25
Joined: Wed Aug 04, 2004 11:59 am

Var probs..

Post by feroz »

Hello,

Just need to know how to get a var from an other proc...
ex:
bind raw - 302 b

proc a {} {
putserv "userhost $nick"
}

proc b { from key arg } {
set g_host [lindex [lrange [split $arg "@"] 1 end] 0
}

Would like to know how i can get $g_host in proc a..
thx.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Re: Var probs..

Post by awyeah »

This should solve your problem:

Code: Select all

bind raw - 302 b

proc b {from key arg} {
 set g_host "[lindex [lrange [split $arg "@"] 1 end] 0]"
 a $g_host
}

proc a {g_host} {
 putlog "$g_host"
 putserv "userhost $nick"
}
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
f
feroz
Voice
Posts: 25
Joined: Wed Aug 04, 2004 11:59 am

Post by feroz »

thx for answering,

let me give you the whole script, coz that wont work...

Code: Select all


bind pubm - "* *" badword:pubm:check

bind raw - 302  realhost

proc badword:pubm:check { nick uhost handle chan arg } {

	global BadwordWarn g_message

	set input " [bad:filter $arg] "

	#Search through the list to see if the badword is present.

	if { [file exists badword.txt] } {

		set read [open badword.txt r]

		while  { ![eof $read] } {

			gets $read line

			set helpwanted [string range $line 0 [expr [string first # $line]-1]]

			set g_message [string range $line [expr [string first # $line]+1] end] 

			if { [string match -nocase "* $helpwanted *" $input] == 1 && $helpwanted != "" } {

				if {([info exists BadwordWarn($uhost)] == 1)} {

					putserv "userhost $nick"
					
#gline part goes here, need the g_host to do that..

					unset BadwordWarn($uhost)

					} else {

					set BadwordWarn($uhost) 1

					timer 60 "unset BadwordWarn($uhost)"

					putserv "kill $nick $message"

				}

			}

		}

		close $read

	}

}

proc realhost { from key arg } {

	set g_host [lindex [lrange [split $arg "@"] 1 end] 0] 


}

it kills on first instance, and need to gline on second.. That's why i send a "userhost" command to get the real host.. but i cant have g_host var back there to gline.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Procedure 'realhost' is useless. :wink:
You can do it without making another procedure. :P

Here use this! :mrgreen:

Code: Select all

bind pubm - "*" badword:pubm:check

proc badword:pubm:check {nick uhost handle chan text} {
 global BadwordWarn g_message
  set input [bad:filter $text]
  if {[file exists badword.txt]} {
  set read [open badword.txt "r"]
   while {![eof $read]} {
   gets $read line
   set helpwanted [string range $line 0 [expr [string first # $line] -1]]
   set g_message [string range $line [expr [string first # $line] +1] end] 
    if {([string match -nocase *$helpwanted* $input] == 1) && ($helpwanted != "")} {
    if {([info exists BadwordWarn($uhost)] == 1)} {
    set host "[lindex [lrange [split $uhost "@"] 1 end] 0]"
    #go ahead and gline the variable $host
    unset BadwordWarn($uhost)
     } else {
     set BadwordWarn($uhost) 1
     timer 60 "unset BadwordWarn($uhost)"
     putquick "KILL $nick $message" -next
     }
    }
   }
  close $read
 }
}
Last edited by awyeah on Fri Aug 13, 2004 9:53 am, edited 2 times in total.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
f
feroz
Voice
Posts: 25
Joined: Wed Aug 04, 2004 11:59 am

Post by feroz »

We got crypted host on our net that's why i tried getting the real one.. So would that work even with crypted host?
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

I am not sure what a 'crypted host' means (not that good in english) and which IRCd you are running. Give it a go! :wink:

Code: Select all

putlog "$nick's userhost is: $host"
Check by adding this putlog after the declaration of the variable '$host' in your procedure. In DCC (partyline) with the bot it will give you a result to compare and check if it is the correct userhost or not. :mrgreen:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
f
feroz
Voice
Posts: 25
Joined: Wed Aug 04, 2004 11:59 am

Post by feroz »

ook, here goes your little test
Mars's userhost is: Mars@B28516ACDACAE8255917C9BED25D1x

that's what i called "crypted" :)
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Okay so I get it, it is ENCRYPTED (hidden).
Hmm, yes for that you will have to do it the way you were doing it before! :mrgreen:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
f
feroz
Voice
Posts: 25
Joined: Wed Aug 04, 2004 11:59 am

Post by feroz »

back to the starting point :p
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

bind pubm - "* *" badword:pubm:check 

bind raw - 302  realhost 

proc badword:pubm:check { nick uhost handle chan arg } { 
   global BadwordWarn g_message g_host
   set input " [bad:filter $arg] " 
   #Search through the list to see if the badword is present. 
   if { [file exists badword.txt] } { 
      set read [open badword.txt r] 
      while  { ![eof $read] } { 
         gets $read line 
         set helpwanted [string range $line 0 [expr [string first # $line]-1]] 
         set g_message [string range $line [expr [string first # $line]+1] end] 
         if { [string match -nocase "* $helpwanted *" $input] == 1 && $helpwanted != "" } { 
            if {([info exists BadwordWarn($uhost)] == 1)} { 
               putserv "userhost $nick" 
#gline part goes here, need the g_host to do that..
	       vwait g_host
#and now you got he g_host....
               unset BadwordWarn($uhost) 
               } else { 
               set BadwordWarn($uhost) 1 
               timer 60 "unset BadwordWarn($uhost)" 
               putserv "kill $nick $message" 
            } 
         } 
      } 
      close $read 
   } 
} 

proc realhost { from key arg } {
   upvar #0 g_host g_host
   set g_host [lindex [lrange [split $arg "@"] 1 end] 0] 
} 
Elen sila lúmenn' omentielvo
f
feroz
Voice
Posts: 25
Joined: Wed Aug 04, 2004 11:59 am

Post by feroz »

ok, just tried papillon's code (thx to him)..

bot just wont respond when i use "vwait" cant rehash.. all i can do is restart.. and it doesnt seem to give g_host.. tried putlog" $g_host" nothing happenin..
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Okay so I get it, it is ENCRYPTED (hidden).
It's masked not encrypted and can be turned off if desired by setting +/-x (in eggdrop)

Code: Select all

proc evnt:init_server {type} {
  global botnick
  putquick "MODE $botnick +i-x"
}
In mIRC it's a simple Perform option: /mode $me -x

Bahamut does not have this ability. Ultimate/Unreal do; and probably many others. It's for the protection of users (if they wish to use it) as the masked host does not resolve.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

But Alchera its the userhost of another person to gline not the host of the bot. :roll:

You cannot change the usermode of another user with MODE $NICK -modechange, you can only change the bots usermodes with that! :mrgreen:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

feroz uses a network where a user can set +/-x to mask/unmask his host (set by the IRCD itself). There is absolutely no way anyone but an IRCOp with the proper flags can get the proper host of a user using +x.

My previous post was an explanation. I did not mention anywhere that a user could change the mode of another user.

Because of this system any script is restricted to using ident.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
f
feroz
Voice
Posts: 25
Joined: Wed Aug 04, 2004 11:59 am

Post by feroz »

Acutually my bot can oper up :mrgreen:
That's why i'm tryin to gline, otherwise i'll just ban the masked host.
And we use an ircd based on Bahamut :wink:
Locked