Forum

> > CS2D > Scripts > Auto ban for advertising ip
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Auto ban for advertising ip

24 Antworten
Seite
Zum Anfang Vorherige 1 2 Nächste Zum Anfang

alt Auto ban for advertising ip

dizziness
User Off Offline

Zitieren
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)

alt Re: Auto ban for advertising ip

DannyDeth
User Off Offline

Zitieren
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.
1× editiert, zuletzt 14.07.11 15:48:18

alt Re: Auto ban for advertising ip

dizziness
User Off Offline

Zitieren
user DannyDeth hat geschrieben
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

alt Re: Auto ban for advertising ip

dizziness
User Off Offline

Zitieren
user Alistaire hat geschrieben
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

alt Re: Auto ban for advertising ip

DannyDeth
User Off Offline

Zitieren
@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.
1× editiert, zuletzt 15.07.11 10:25:18

alt Re: Auto ban for advertising ip

dizziness
User Off Offline

Zitieren
user DannyDeth hat geschrieben
@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

alt Re: Auto ban for advertising ip

DannyDeth
User Off Offline

Zitieren
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. )

alt Re: Auto ban for advertising ip

dizziness
User Off Offline

Zitieren
user DannyDeth hat geschrieben
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

alt Re: Auto ban for advertising ip

DannyDeth
User Off Offline

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

alt Re: Auto ban for advertising ip

dizziness
User Off Offline

Zitieren
user DannyDeth hat geschrieben
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

alt Re: Auto ban for advertising ip

dizziness
User Off Offline

Zitieren
user Apache uwu hat geschrieben
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

alt Re: Auto ban for advertising ip

EngiN33R
Moderator Off Offline

Zitieren
user dizziness hat geschrieben
user Apache uwu hat geschrieben
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.

alt Re: Auto ban for advertising ip

dizziness
User Off Offline

Zitieren
user EngiN33R hat geschrieben
user dizziness hat geschrieben
user Apache uwu hat geschrieben
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

alt Re: Auto ban for advertising ip

DannyDeth
User Off Offline

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

alt Re: Auto ban for advertising ip

dizziness
User Off Offline

Zitieren
user DannyDeth hat geschrieben
@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 >

alt Re: Auto ban for advertising ip

Cure Pikachu
User Off Offline

Zitieren
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.
Zum Anfang Vorherige 1 2 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht