|
Joined: Mar 2004
Posts: 155
Vogon poet
|
OP
Vogon poet
Joined: Mar 2004
Posts: 155 |
I'm not sure if this is possible but here goes anywho. I'm looking for a snippet or script that can be read and written to when someone in my channel posts a URL. Since this gets a little confusing allow me to show an example: say john_doe comes into my channel and types !links jane_doe my script would read from a text file and notice john_doe jane_doe's links. The links should be able to be added to the text file by say jane_doe entering my channel and typing !add jane_doe www.url.com/php??? (the url will always be the same as say www.url.com/php just the numbers at the end would be different) but if jane_doe entered and typed !add jane_doe www.smut.com it would not add the url but would also kick/ban her for 30seconds or so. I'm not sure if i am explaining this correctly because to be honest when i am reading it now, i myself am asking WTF i am trying to say but this is the only way i can think to explain it. thanks in advance for any advice/snippets/scripts or links to anything like this type of script.
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
Hi, Start -> Run -> wordpad.exe -> paste code -> copy code to mIRC Scripts Editor (alt+r): Before doing anything type: /write urls.txt
menu channel {
.$iif($group(#urlscript) == on,Disable,Enable) URL Script:{
$iif($group(#urlscript) == on,disable,enable) #urlscript
}
}
[color:red] [/color]
#urlscript on
on *:START: hmake urls | hload -i urls urls.txt
on *:EXIT: hsave -i urls urls.txt
[color:red] [/color]
on *:TEXT:*:#:{
if ($1-2 == !add $nick) && $3 {
if !$regex($3,/^www\..+?\.com\/php\d*$/i) { msg # Incorrect url syntax. | return }
hadd urls $nick $addtok($hget(urls,$nick),$3,32)
.msg $nick Added url $3 to your account
}
elseif ($1 == !links) && $hget(urls,$2) {
.msg $nick Here are $2's links:
tokenize 32 $ifmatch
.msg $nick $*
}
}
#urlscript end
How does it work? 1. When someone types !add < hisownnick> < url> the url will be added, if it's syntax is www.whatever.com/php..... (dots are numbers) 2. When someone types !links < somenick> the snippet will pm the requester, but only if the requested nick has urls in the hash table. 3. When starting up mIRC a hash table urls will be created, which will load the contents of url.txt in it. That's why you had to type /write urls.txt before using the script. You are of course free to choose what name you want to give that .txt file. But then be sure to change urls.txt to whatever in the code. 4. You might want to change # to whatever channels you want to let this script trigger at. 5. Right now there is a limit of around 30 urls for each user, but that is of course depending on how long they will be. If you think this could be an issue, let me know and I'll modify the script. 6. About the www.smut.com, well there can be literaly thousands of websites that can be seen as "bad"..there's really no way to ban all of them. If you really insist, I can add it so it will ban a user when they type www.smut.com, but well, they can come up with anything. 7. You might get flooded off the server when there is an excessive !links request. Try the script like this first...if you seem to experience trouble flooding out or anything, then I'll modify the script using the /play command which has a queueing system and where you can specify a message interval. Greets
Last edited by FiberOPtics; 18/06/04 03:28 PM.
Gone.
|
|
|
|
Joined: Mar 2004
Posts: 155
Vogon poet
|
OP
Vogon poet
Joined: Mar 2004
Posts: 155 |
Awesome script. Exactly what i was looking for. Thanks a million for your help. As for the www.smut.com part i should of said it would ban anyone that attempts to post a url other then the www.url.com/php... of course the dots being the numbers in the url. Sort of like elseif www.url.com/gohere then it would kickban the poster because it is missing the /php and therefore the script would know it was a bad link. For example, let's say the site that holds the links is www.gamelinks.com/php123 but john_doe comes in a posts www.gamelicks.com/smut/gohere.htm you can plainly see that that address doesn't have the "required" url beginning therefore the script would kick/ban the poster of that url. Once again thank you for your help, i was beginning to think no one knew wtf i was talking about lol.
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
Hi, glad you like it. Replace the old $regex line with this new one:
if !$regex($3,/^www\..+?\.com\/php\d*$/i) { ban -ku30 # $nick 2 Incorrect url syntax. | return }
Now when a person tries to enter a URL that doesn't have the right syntax, the script will ban+kick the user, and the ban will be removed in 30 seconds. OK regarding the bad url thing, there are two more things I need to know: 1. Will there ALWAYS be numbers after the php or is it optional? Because currently it's setup to react on /php or /php... dots being numbers. 2. If there are numbers behind the /php, will it always be just 3 numbers or can it be a variable amount of numbers? Because currently it's setup to react to 0-infinite numbers. I'm going to assume that there always have to be 3 digits behind the /php, but the value of them will be variable. In thise case change the regex identifier to: if !$regex($3,/^www\..+?\.com\/php\d{3}$/i) { ... Greets
Last edited by FiberOPtics; 19/06/04 12:08 AM.
Gone.
|
|
|
|
Joined: Mar 2004
Posts: 155
Vogon poet
|
OP
Vogon poet
Joined: Mar 2004
Posts: 155 |
the numbers after /php would be optional, but the amount of numbers can very anywhere from one digit to whatever .. there is no certain amount of numbers as there will be many links posted from many players.
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
Ok, then you're all set. So don't change the first $regex from my last post, and it'll do what it's supposed to do Cya
Gone.
|
|
|
|
Joined: Apr 2003
Posts: 701
Hoopy frood
|
Hoopy frood
Joined: Apr 2003
Posts: 701 |
If the domain is always the same (like ww [/b]w.gamelinks.com), it would be better to change the $regex part to
if !$regex($3,/^[color:blue]www\.gamelinks\.com[/color]\/php\d*$/i) {[color:grey]...[/color]
If you want to put in your domain name, just replace the blue part, only special thing is to put a backslash \ before each dot in the domain name. ww[b]w.users.isp.com would become www\.users\.isp\.com
|
|
|
|
Joined: Jun 2004
Posts: 11
Pikka bird
|
Pikka bird
Joined: Jun 2004
Posts: 11 |
Im looking for a script very similar to this and attempted to use this but i cannot get it to respond in a channel. ive pasted it to script editor and saved it and loaded it but get nothing when trying execute. What am i doing wrong? Thanks
|
|
|
|
Joined: Jun 2003
Posts: 994
Hoopy frood
|
Hoopy frood
Joined: Jun 2003
Posts: 994 |
If you copied the original script with Internet Explorer and pasted directly to remotes, you lost all formatting. Copy it again, and paste it to Wordpad. Now copy what is in Wordpad, and paste it to remotes. Should work now.
Note: Internet Explorer is the ONLY browser I've seen that does this. If you use ANYTHING else, a direct copy/paste to remotes works just fine.
I refuse to engage in a battle of wits with an unarmed person.
|
|
|
|
Joined: Jun 2004
Posts: 11
Pikka bird
|
Pikka bird
Joined: Jun 2004
Posts: 11 |
can you maybe rewrite the regex line all links will be http://www.abcdefg.com/recruit.php?id=12356however the last number may be 21345 1234 or any other random number Thanks again for all of your knowledge
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
Hi, is the site actually always going to be www.abcdefg.com or is the abcdefg an example to say, that it has to be any site like http://www.somerandomsite.com/recruit.php?=somenumbers ? If it has to be literally abcdefg, then use this regex: if !$regex(<input>,/^http:\/\/www\.abcdefg\.com\/recruit\.php\?id=\d+$/i) { msg # Incorrect URL SYntax return } else use: if !$regex(<input>,/^http:\/\/www\..+?\.com\/recruit\.php\?id=\d+$/i) { msg # Incorrect URL Syntax return } Replace <input> with the url that you want to test. Bye
Last edited by FiberOPtics; 26/06/04 01:22 PM.
Gone.
|
|
|
|
Joined: Jun 2004
Posts: 11
Pikka bird
|
Pikka bird
Joined: Jun 2004
Posts: 11 |
ok now im starting to be a pain but i am having a hell of a time with this script.... [script] menu channel { .$iif($group(#urlscript) == on,Disable,Enable) URL Script:{ $iif($group(#urlscript) == on,disable,enable) #urlscript } } #urlscript on on *:START: hmake urls | hload -i urls urls.txt on *:EXIT: hsave -i urls urls.txt on *:TEXT:*:#ghost6303:{ if ($1-2 == !setlink $nick) && $3 { if !$regex( http://www.plattleround.com/recruit.php?id=6536 ,/^http:\/\/www\.plattleround\.com\/recruit\.php\?id=\d+$/i) { msg #ghost6303 Incorrect URL SYntax return } hadd urls $nick $addtok($hget(urls,$nick),$3,32) msg #ghost6303 $nick This link $3 has been added to your account } elseif ($1 == !mylink) && $hget(urls,$2) { .msg $nick Here are $2's links: tokenize 32 $ifmatch .msg $nick $* } } #urlscript end as long as the link with the number in red appears as it is here everything seems to work fine if the number in red is diff it shows as incorrect url syntax. Ive tried to take the numbers off and stop it at the = sign and it still shows as incorrect. This is the permanant link only thing that will change will be the numbers in red. I want the user to be able to store their links and on command from any user use !getlink ghost6303 ... it then post GHOST6303's link is ....also i dont need 30 slots per user 1 will be fine... if its not too much to ask i wouldnt mind having a !mylink feature where the user that owns the link can do a !mylink and it post their link. As stated in earlier post i want a kick/ban feature that will kick and ban a user for posting any other link than the one in this script for 30 seconds. I thank every one of you sooo much this is driving me nuts and i appreciate all of your help
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
Hi, Start --> Run --> wordpad --> paste code --> copy code to mIRC Scripts Editor:
menu channel {
.$iif($group(#urlscript) == on,Disable,Enable) URL Script:{
$iif($group(#urlscript) == on,disable,enable) #urlscript
}
}
[color:red] [/color]
#urlscript on
on *:START: hmake urls | hload urls urls.txt
on *:EXIT: hsave urls urls.txt
[color:red] [/color]
on *:TEXT:*:#ghost6303:{
if ($1-2 == !setlink $nick) && $3 {
if !$regex($3,/^http:\/\/www\.plattleround\.com\/recruit\.php\?id=\d+$/i) {
ban -ku30 # $nick 2 Incorrect url syntax.
return
}
hadd urls $nick $3
msg # $nick This link $3 has been added to your account
}
elseif ($1 == !getlink) && $hget(urls,$2) {
msg # This is $2's link: $ifmatch
}
elseif ($1 == !mylink) && $hget(urls,$nick) {
msg # $nick Your current url: $ifmatch
}
}
#urlscript end
1. The script is now limited to 1 link per user, so if a user adds a new link, the old one is overwritten. 2. Note that you don't have to put #ghost6303 within the event, because right now the script only reacts when it's in channel #ghost6303, so the # will be filled with that channel name. 3. I've changed the hash table to be saved in non-ini format. Originally I set it that way, so that you have good readability when you are viewing the text file yourself, however, it entered my mind that nicknames with [ ] surrounding their nick, will be saved as ~nick~, thus corrupting the nickname. This is because mIRC would interpret the nickname as a section from an ini file. So you should clear the urls.txt file, to start over. Enjoy
Gone.
|
|
|
|
Joined: Jun 2004
Posts: 11
Pikka bird
|
Pikka bird
Joined: Jun 2004
Posts: 11 |
Absolutely awesome I greatly appreciate it. Works like ive been hoping it would !!!
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
I'm glad it's working out well, cya around!
Gone.
|
|
|
|
|