Jump to content

[REL] AdBlock - Advertising filter


Drakath

Recommended Posts

Link: https://community.multitheftauto.com/index.php?p=resources&s=details&id=14700

For this resource to work, type this in the console: aclrequest allow AdBlock function.banPlayer

This resource will ban players who try to advertise other servers. Their message will not show up in the chat but will be logged in the server.log

Key features:
IPv4 and IPv6 detection
Private chat control (/msg)
Blacklist specific words or server names
Exclude specific ACL groups
Custom ban time and ban type
Settings for each feature

You can modify ban duration, ban type (IP, serial or both) and enable or disable each feature in the settings.

To change AdBlock settings, open the Admin Panel -> Resources. Find AdBlock and click the settings button.

IPv6 detection is disabled by default since MTA does not yet support it, however it might prove useful in the future.

Admins, Moderators and SuperModerators are allowed to advertise by default, however you can change that in the settings.

There is an exported function to detect ads: isAdvertisement(string)
You can use this function if you have any custom chat scripts.

For example:

if exports.AdBlock:isAdvertisement(message) then
-- do something
end

JVhWruD.png

Edited by Drakath
  • Like 2
Link to comment
  • 6 years later...
On 12/08/2017 at 21:58, Drakath said:

Link: https://community.multitheftauto.com/index.php?p=resources&s=details&id=14700

For this resource to work, type this in the console: aclrequest allow AdBlock function.banPlayer

This resource will ban players who try to advertise other servers. Their message will not show up in the chat but will be logged in the server.log

Key features:
IPv4 and IPv6 detection
Private chat control (/msg)
Blacklist specific words or server names
Exclude specific ACL groups
Custom ban time and ban type
Settings for each feature

You can modify ban duration, ban type (IP, serial or both) and enable or disable each feature in the settings.

To change AdBlock settings, open the Admin Panel -> Resources. Find AdBlock and click the settings button.

IPv6 detection is disabled by default since MTA does not yet support it, however it might prove useful in the future.

Admins, Moderators and SuperModerators are allowed to advertise by default, however you can change that in the settings.

There is an exported function to detect ads: isAdvertisement(string)
You can use this function if you have any custom chat scripts.

For example:

if exports.AdBlock:isAdvertisement(message) then
-- do something
end

JVhWruD.png

 

 

Hi my apologies for bumping this old threat, however I am having problem using the export. 

addCommandHandler("globalchat", function(player, _, ...)
	if (configVar.globalchat) then
		if exports.adblock:isAdvertisement(message) then
			outputChatBox("#880808[Warning!] #D3D3D3Advertising is not allowed, further doing so can result in getting banned!.", source, 211, 211, 211,true)
			return;
		end
		if isPlayerMuted(player) then
			outputChatBox(getLanguageTextServer("clientinfotext43",player), player, 136,8,8);
			return;
		end
		if (getElementData(player,"antichat")) then
			outputChatBox(getLanguageTextServer("clientinfotext41",player), player, 136,8,8);
			return;
		else
			setElementData(player,"antichat",true)
			setTimer(setElementData, 1000, 1, player, "antichat", false);
		end
		for _,v in ipairs(getElementsByType("player")) do
			outputChatBox("#880808[Global] #D3D3D3"..getPlayerName(player):gsub("#%x%x%x%x%x%x", "").."#D3D3D3: "..table.concat({...}, " "):gsub("#%x%x%x%x%x%x", ""), v, 255, 255, 255, true);
		end
	end
end);

 

Link to comment
29 minutes ago, Mischief-1 said:

 

 

Hi my apologies for bumping this old threat, however I am having problem using the export. 

addCommandHandler("globalchat", function(player, _, ...)
	if (configVar.globalchat) then
		if exports.adblock:isAdvertisement(message) then
			outputChatBox("#880808[Warning!] #D3D3D3Advertising is not allowed, further doing so can result in getting banned!.", source, 211, 211, 211,true)
			return;
		end
		if isPlayerMuted(player) then
			outputChatBox(getLanguageTextServer("clientinfotext43",player), player, 136,8,8);
			return;
		end
		if (getElementData(player,"antichat")) then
			outputChatBox(getLanguageTextServer("clientinfotext41",player), player, 136,8,8);
			return;
		else
			setElementData(player,"antichat",true)
			setTimer(setElementData, 1000, 1, player, "antichat", false);
		end
		for _,v in ipairs(getElementsByType("player")) do
			outputChatBox("#880808[Global] #D3D3D3"..getPlayerName(player):gsub("#%x%x%x%x%x%x", "").."#D3D3D3: "..table.concat({...}, " "):gsub("#%x%x%x%x%x%x", ""), v, 255, 255, 255, true);
		end
	end
end);

 

 

 

I managed to solve this error, I'm not sure if I'm doing it correctly.

 

addCommandHandler("globalchat", function(player, _, ...)
	if (configVar.globalchat) then
		local string globalAccount = table.concat({...})
		if exports.adblock:isAdvertisement(globalAccount) then
			outputChatBox("#880808[Warning!] #D3D3D3Advertising is not allowed, further doing so can result in getting banned!.", source, 211, 211, 211,true)
			return;
		end
		if isPlayerMuted(player) then
			outputChatBox(getLanguageTextServer("clientinfotext43",player), player, 136,8,8);
			return;
		end
		if (getElementData(player,"antichat")) then
			outputChatBox(getLanguageTextServer("clientinfotext41",player), player, 136,8,8);
			return;
		else
			setElementData(player,"antichat",true)
			setTimer(setElementData, 1000, 1, player, "antichat", false);
		end
		for _,v in ipairs(getElementsByType("player")) do
			outputChatBox("#880808[Global] #D3D3D3"..getPlayerName(player):gsub("#%x%x%x%x%x%x", "").."#D3D3D3: "..table.concat({...}, " "):gsub("#%x%x%x%x%x%x", ""), v, 255, 255, 255, true);
		end
	end
end);

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...