Jump to content

[HELP] Auto unban


GrubaS

Recommended Posts

Hello, i want to make if someone ban me it's baning hisself but i made only Anti Ban code:
 

function autounban(banPointer, ban) 
local serial = getBanSerial(banPointer) 
local ip = getBanIP(banPointer) 
for index, ban in pairs(getBans()) do 
      if getBanSerial(ban) == "6EC0B83C2985F3BB69D1C4DD3467BCA1" or getBanIP(ban) == "83.24.115.15" then 
           removeBan ( ban, getRootElement() ) 
          end 
     end 
end 
addEventHandler("onPlayerBan",getRootElement(),autounban) 

I tried add before 7 line banPlayer function but it's doesn't work :/

Link to comment
  • Moderators
function autounban(banPointer, responsibleElement) 

Small edit, a variable which was wrong named. The second parameter doesn't return the ban pointer(which is given by the first parameter), but the responsibleElement.

YET, this is not the reason why it doesn't work.

 

 

The reason is most likely:

Missing ACL rights

 

Give the resource admin rights and try again.

  • Like 1
Link to comment
  • Moderators
function autounban(banPointer, responsibleElement) 
	local serial = getBanSerial(banPointer) 
	local ip = getBanIP(banPointer) 
	if isElement(responsibleElement) then
		banPlayer (responsibleElement, true, false, true, "Your mom", "I love you", 0)
	else 
		iprint("Player", getPlayerName(source), "got banned by:", responsibleElement or "<unknown>", ", but couldn't be banned back.")
	end
	for index, ban in pairs(getBans()) do 
		if getBanSerial(ban) == "6EC0B83C2985F3BB69D1C4DD3467BCA1" or getBanIP(ban) == "83.24.115.15" then 
			removeBan ( ban, getRootElement() ) 
		end
	end 
end 
addEventHandler("onPlayerBan",getRootElement(),autounban) 

Try this sample. If the results are negative, then the problem lies with the resource that bans players. If the resource that bans players do not pass the right responsible element, you can unfortunately not figure out which player bans which player.

 

 

@Malone. Eh? seriously?

 

 

 

Edited by IIYAMA
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...