Some of it's ripped from here: http://www.hawkee.com/snippet/3555/
Edit: Actually it looks like it comes from your other code, so I guess DemonicDerek copied ur code? :/
You should fix this line btw:
If ($strip($1) == +b) mode $chan +b $adress ($2,4)