Forum
![>](img/i_next.png)
![>](img/icons/cs2d.png)
![>](img/i_next.png)
![>](img/i_next.png)
Auto ban for advertising ip
24 replies1
2
3
4
2
3
4
addhook("say","check_for_ip") function check_for_ip(id,txt) 	if(string.find(txt,"%d+%.%d+%.%d+%.%d+")) then parse("banip "..player(id,"ip")) end end
EDIT: Changed to ban.
EDIT2: Corrected it for an error.
EDIT3: Re-corrected the same error.
![](img/smiles/tongue.gif)
edited 1×, last 14.07.11 03:48:18 pm
![user](img/i_friend.png)
1
2
3
4
2
3
4
addhook("say","check_for_ip") function check_for_ip(id,txt) 	if(string.find(txt,"%d+%.%d+%.%d+%.%d+")) then parse("banip "..player(id,"ip")) end end
EDIT: Changed to ban.
EDIT2: Corrected it for an error.
EDIT3: Re-corrected the same error.
![](img/smiles/tongue.gif)
Thank you, DannyDeth I will testing your lua scirpt %d = Net mask?
![](img/smiles/cry.gif)
![](img/smiles/cry.gif)
You get a ban too
![](img/smiles/joy.gif)
Ooh, But there is changelog rights? So when someone get banned and they request unbanned at my forums, And they lieing I will not unban it, It just simplest way
loL why you do it @ @
No, it will not ban you if you type 'my KpD is 3.5', however it will ban you if you type something with 4 or more dots in it. ( because 1.1.1.1.1.1 still has 1.1.1.1 in it
![](img/smiles/tongue.gif)
EDIT: and, if you want it to keep a log as well:
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
addhook("say","check_for_ip") function check_for_ip(id,txt) if(string.find(txt,"%d+%.%d+%.%d+%.%d+")) then 		log_advertiser(id,txt) 		parse("banip "..ip) 	end end function log_advertiser(id,txt) 	log_f = io.open("sys/lua/ip_advertisement/log.txt","a+") 	log_f:write("\nDetected IP advertisement from player ( ID: "..id.."; IP: "..player(id,"ip").."; USGN: "..player(id,"usgn").."; )\nPlayer said: "..txt.."\nPlayer was auto-banned.") end
edited 1×, last 15.07.11 10:25:18 am
![user](img/i_friend.png)
@2Fast4You:
No, it will not ban you if you type 'my KpD is 3.5', however it will ban you if you type something with 4 or more dots in it. ( because 1.1.1.1.1.1 still has 1.1.1.1 in it
)
EDIT: and, if you want it to keep a log as well:
That way you can check if the player requesting an unban was doing IP adverts.
No, it will not ban you if you type 'my KpD is 3.5', however it will ban you if you type something with 4 or more dots in it. ( because 1.1.1.1.1.1 still has 1.1.1.1 in it
![](img/smiles/tongue.gif)
EDIT: and, if you want it to keep a log as well:
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
addhook("say","check_for_ip") function check_for_ip(id,txt) if(string.find(txt,"%d+%.%d+%.%d+%.%d+")) then 		log_advertiser(id,txt) 		parse("banip "..ip) 	end end function log_advertiser(id,txt) 	log_f = io.open("sys/lua/ip_advertisement/log.txt","a+") 	log_f:write("\nDetected IP advertisement from player ( ID: "..id.."; IP: "..player(id,"ip").."; USGN: "..player(id,"usgn").."; )\nPlayer said: "..txt.."\nPlayer was auto-banned.") end
Woah, thanks alot for you newest lua script, btw I think this lua script have 1 bugs and cannot be fixed forever because Some of my moderator get banned because saying some of player ip
![](img/smiles/ugly.gif)
The code is inside the spoiler. Replace the 123 and 456 numbers with the USGN id's of ur mods. ( seperate them with commas. )
![user](img/i_friend.png)
The code is inside the spoiler. Replace the 123 and 456 numbers with the USGN id's of ur mods. ( seperate them with commas. )
Huuh, DannyDeath did you have a server? Because if you have a server maybe your server will be fun because you can make a lua script
And, yeah, this stuff is easy. You should see some of the other stuff I've written, haha.
![user](img/i_friend.png)
I run six servers on a WAN in South Africa, I might start hosting for the rest of the world, soon.
And, yeah, this stuff is easy. You should see some of the other stuff I've written, haha.
And, yeah, this stuff is easy. You should see some of the other stuff I've written, haha.
DannyDeath, for you it easy but for me?
![](img/smiles/cry.gif)
String.match ---> "(.*).(.*).(.*).(.*)"
IF ---> (.*) <0 >256
No code shown, but you get the idea.
![user](img/i_friend.png)
Fail. you could do this...
String.match ---> "(.*).(.*).(.*).(.*)"
IF ---> (.*) <0 >256
No code shown, but you get the idea.
String.match ---> "(.*).(.*).(.*).(.*)"
IF ---> (.*) <0 >256
No code shown, but you get the idea.
I don't care about that, DannyDeath already give the lua script and it work well
![user](img/i_friend.png)
![user](img/i_friend.png)
Fail. you could do this...
String.match ---> "(.*).(.*).(.*).(.*)"
IF ---> (.*) <0 >256
No code shown, but you get the idea.
String.match ---> "(.*).(.*).(.*).(.*)"
IF ---> (.*) <0 >256
No code shown, but you get the idea.
I don't care about that, DannyDeath already give the lua script and it work well
Yay, users getting banned for having four periods in their messages! Don't be so ignorant - if there's something that could work better, you should use it.
![user](img/i_friend.png)
![user](img/i_friend.png)
![user](img/i_friend.png)
Fail. you could do this...
String.match ---> "(.*).(.*).(.*).(.*)"
IF ---> (.*) <0 >256
No code shown, but you get the idea.
String.match ---> "(.*).(.*).(.*).(.*)"
IF ---> (.*) <0 >256
No code shown, but you get the idea.
I don't care about that, DannyDeath already give the lua script and it work well
Yay, users getting banned for having four periods in their messages! Don't be so ignorant - if there's something that could work better, you should use it.
So can you edit it for me? I dosen't understand what that guy saying because I'm not a good scripter
![](img/smiles/cry.gif)
Meh, you could write "hi.there.how.are" and it would probably ban you.
![](img/smiles/thoughtfully2.gif)
![user](img/i_friend.png)
@Textual Content:
Meh, you could write "hi.there.how.are" and it would probably ban you.
There is no way to specify the content of a * wildcard in Lua.
Meh, you could write "hi.there.how.are" and it would probably ban you.
![](img/smiles/thoughtfully2.gif)
DannyDeth, This lua script is not working, so can you fix it?
Time to "flip over" the not_mod(id) function.
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
function not_mod(id) 	for i=0,#mods,1 do 		if player(id,"usgn")==mods[i] then 			return false -- Flipped 		end 	end 	return true -- Flipped end