Jump to content

antiban


Hiding

Recommended Posts

function antiban ( banPointer, responsibleElement )

-- I dont know what I should to write here.. :D

if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "admin" ) ) then
    cancelEvent()
    outputChatBox("This is a bad idea. :)", 255, 255, 255, true)    
    
addEventHandler ( "onPlayerBan", getRootElement(), antiban )

Edited by Hiding
Link to comment
addEventHandler ( "onPlayerBan", getRootElement(), 
function ( banPointer, responsibleElement )
accountname = getAccountName ( getPlayerAccount ( source ) )
if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "admin" ) ) then
    cancelEvent()
    outputChatBox("This is a bad idea. :)", 255, 255, 255, true)    
    end
end
)
--try it server side

 

  • Like 1
Link to comment
addEventHandler ( "onPlayerBan", getRootElement(), 
function ( banPointer, responsibleElement )
accountname = getAccountName ( getPlayerAccount ( source ) )
if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then
    cancelEvent()
    outputChatBox("This is a bad idea. :)", 255, 255, 255, true)    
    end
end
)

try it now

  • Like 1
Link to comment
addEventHandler ( "onPlayerBan", getRootElement(), 
function ( banPointer, rb )
accountname = getAccountName ( getPlayerAccount ( source ) )
if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then
    cancelEvent()
    outputChatBox("This is a bad idea. :)",rb, 255, 255, 255, true)    
    end
end
)

try this

  • Like 1
Link to comment
Just now, Hiding said:

It is works, I mean write to the chat "Bad idea", but is still banning :D 

u can not use ( cancelEvent with onPlayerBan )

but u can use
 

removeBan


test it

 

function onBan ( _, Player )
	if isObjectInACLGroup ( "user."..getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Admin" ) ) then
		removeBan ( source )
		outputChatBox("This is a bad idea. :)",Player , 255, 255, 255, true)    
	end
end
addEventHandler ( "onPlayerBan", root, onBan )

 

  • Like 1
Link to comment

source here is the player
try this

this will ban the player but it will remove the ban

 

addEventHandler ( "onBan", getRootElement(), 
function ( myban )
accountname = getAccountName ( getPlayerAccount ( source ) )
if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then
removeBan ( myban )
    outputChatBox("some one tried to ban the admin "..source.." . :)", root, 255, 255, 255, true)    
    end
end
)

 

Edited by 3laa33
  • Like 1
Link to comment
Just now, Hiding said:

Bad argument @ 'removeBan' [Expected ban at argument 1, got player]

 


test it

 

function onBan ( _, Player )
	for _, ban in ipairs( getBans() )do
		if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(source)),aclGetGroup("Admin")) then
			if getPlayerName ( source ) == getBanNick( ban ) then
				if ( removeBan ( ban ) ) then
					outputChatBox("This is a bad idea. :)",Player , 255, 255, 255, true)    
				end
			end
		end
	end
end
addEventHandler ( "onPlayerBan", root, onBan )

 

  • Like 1
Link to comment
  • 5 years later...

open this file: /admin/server/admin_server.lua

and search 

elseif ( action == "ban" ) then
search for this line and replace with the following
elseif ( action == "ban" ) then
			if ( hasObjectPermissionTo ( player, "general.adminpanel", true ) ) then
				return outputChatBox("You can't ban this player", source, 255, 100, 70)
			end

 

If Banned Player has admin panel Access, it cancels ban.

6 hours ago, xJJ said:

Merhaba Hiding, anti-kick yapmayı biliyor musun?

elseif ( action == "kick" ) then
            if ( hasObjectPermissionTo ( player, "general.adminpanel", true ) ) then
                return outputChatBox("You can't kick this player", source, 255, 100, 70)
            end

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