Forum

> > CS2D > Scripts > Auto ban for advertising ip
Forums overviewCS2D overview Scripts overviewLog in to reply

English Auto ban for advertising ip

24 replies
Page
To the start Previous 1 2 Next To the start

old Auto ban for advertising ip

dizziness
User Off Offline

Quote
Hello, everyone can you help me making auto ban for advertising ip? Because some of players are advertising their ip (I don't like that because why they not respect the rules? I already said don't advertising ip but they still do that It meaning they not reading the rules)

old Re: Auto ban for advertising ip

DannyDeth
User Off Offline

Quote
1
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
I haven't tested it, but I think it will work.
EDIT: Changed to ban.
EDIT2: Corrected it for an error.
EDIT3: Re-corrected the same error.
edited 1×, last 14.07.11 03:48:18 pm

old Re: Auto ban for advertising ip

dizziness
User Off Offline

Quote
user DannyDeth has written
1
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
I haven't tested it, but I think it will work.
EDIT: Changed to ban.
EDIT2: Corrected it for an error.
EDIT3: Re-corrected the same error.


Thank you, DannyDeth I will testing your lua scirpt %d = Net mask? I never know net mask code at lua script

old Re: Auto ban for advertising ip

dizziness
User Off Offline

Quote
user Alistaire has written
If you write this:

Spoiler >


You get a ban too


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

old Re: Auto ban for advertising ip

DannyDeth
User Off Offline

Quote
@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:
1
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
That way you can check if the player requesting an unban was doing IP adverts.
edited 1×, last 15.07.11 10:25:18 am

old Re: Auto ban for advertising ip

dizziness
User Off Offline

Quote
user DannyDeth has written
@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:
1
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
That way you can check if the player requesting an unban was doing IP adverts.


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 I think now he is crying now because got banned

old Re: Auto ban for advertising ip

DannyDeth
User Off Offline

Quote
Spoiler >

The code is inside the spoiler. Replace the 123 and 456 numbers with the USGN id's of ur mods. ( seperate them with commas. )

old Re: Auto ban for advertising ip

dizziness
User Off Offline

Quote
user DannyDeth has written
Spoiler >

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

old Re: Auto ban for advertising ip

DannyDeth
User Off Offline

Quote
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.

old Re: Auto ban for advertising ip

dizziness
User Off Offline

Quote
user DannyDeth has written
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.


DannyDeath, for you it easy but for me? I dosen't understand lua script even i already learn it

old Re: Auto ban for advertising ip

dizziness
User Off Offline

Quote
user Apache uwu has written
Fail. you could do this...

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

old Re: Auto ban for advertising ip

EngiN33R
Moderator Off Offline

Quote
user dizziness has written
user Apache uwu has written
Fail. you could do this...

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.

old Re: Auto ban for advertising ip

dizziness
User Off Offline

Quote
user EngiN33R has written
user dizziness has written
user Apache uwu has written
Fail. you could do this...

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

old Re: Auto ban for advertising ip

DannyDeth
User Off Offline

Quote
@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.

old Re: Auto ban for advertising ip

dizziness
User Off Offline

Quote
user DannyDeth has written
@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.


DannyDeth, This lua script is not working, so can you fix it?

Spoiler >

old Re: Auto ban for advertising ip

Cure Pikachu
User Off Offline

Quote
That script does the opposite of what the script is supposed to do. (Ban non-moderators who mentions content with 4 dots)

Time to "flip over" the not_mod(id) function.
1
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
The rest is kept intact.
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview