Hiding Posted June 8, 2017 Share Posted June 8, 2017 Hello guys, I want to make a script which does not allow to ban the Admin, or the serial with supermoderator or with any rights. I have some ideas, but it does not enough to start it. Link to comment
AE. Posted June 8, 2017 Share Posted June 8, 2017 (edited) use (onPlayerBan) event and check if the player is admin (isObjectInACLGroup) then cancel the event ( cancelEvent() ) Edited June 8, 2017 by 3laa33 1 Link to comment
Hiding Posted June 8, 2017 Author Share Posted June 8, 2017 (edited) function antiban ( banPointer, responsibleElement ) -- I dont know what I should to write here.. if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "admin" ) ) then cancelEvent() outputChatBox("This is a bad idea. :)", 255, 255, 255, true) addEventHandler ( "onPlayerBan", getRootElement(), antiban ) Edited June 8, 2017 by Hiding Link to comment
AE. Posted June 8, 2017 Share Posted June 8, 2017 you have to write variable accountname like this accountname = getAccountName ( getPlayerAccount ( source ) ) Link to comment
Hiding Posted June 8, 2017 Author Share Posted June 8, 2017 Thank you for your help, but I don't get it really.. Link to comment
AE. Posted June 8, 2017 Share Posted June 8, 2017 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 1 Link to comment
AE. Posted June 8, 2017 Share Posted June 8, 2017 does it type in the chat anything ? Link to comment
AE. Posted June 8, 2017 Share Posted June 8, 2017 then the player that got banned is not in admin group ... + type in f8 debugscript 3 and tell me what happens when you ban the admin 1 Link to comment
Hiding Posted June 8, 2017 Author Share Posted June 8, 2017 Bad argument @ 'isObjectInACLGroup' [Expected acl-group at argument 2, got boolean] Link to comment
AE. Posted June 8, 2017 Share Posted June 8, 2017 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 1 Link to comment
Hiding Posted June 8, 2017 Author Share Posted June 8, 2017 Bad argument @ 'outputChatBox' [Expected element at argument 2, got number '255"] but if I delete the outputChatbox part then nothing Link to comment
AHMED MOSTAFA Posted June 8, 2017 Share Posted June 8, 2017 Just now, Hiding said: Bad argument @ 'outputChatBox' [Expected element at argument 2, got number '255"] but if I delete the outputChatbox part then nothing outputChatBox("This is a bad idea. :)", responsibleElement, 255, 255, 255, true) 1 Link to comment
AE. Posted June 8, 2017 Share Posted June 8, 2017 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 1 Link to comment
Hiding Posted June 8, 2017 Author Share Posted June 8, 2017 It is works, I mean write to the chat "Bad idea", but is still banning Link to comment
AHMED MOSTAFA Posted June 8, 2017 Share Posted June 8, 2017 Just now, Hiding said: It is works, I mean write to the chat "Bad idea", but is still banning 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 ) 1 Link to comment
Hiding Posted June 8, 2017 Author Share Posted June 8, 2017 Bad argument @ 'removeBan' [Expected ban at argument 1, got player] Link to comment
AE. Posted June 8, 2017 Share Posted June 8, 2017 (edited) 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 June 8, 2017 by 3laa33 1 Link to comment
AHMED MOSTAFA Posted June 8, 2017 Share Posted June 8, 2017 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 ) 1 Link to comment
Hiding Posted June 9, 2017 Author Share Posted June 9, 2017 (edited) Thank you guys, the last one is working! Btw is it working against kick? or can I use cancelEvent against kick? Edited June 9, 2017 by Hiding Link to comment
xJJ Posted April 15, 2023 Share Posted April 15, 2023 Hi Hiding, do you know how to do an anti-kick? Link to comment
FLUSHBICEPS Posted April 16, 2023 Share Posted April 16, 2023 onPlayerQuit, quitType = "Kicked" Link to comment
CastiaL Posted April 16, 2023 Share Posted April 16, 2023 (edited) 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 April 16, 2023 by CastiaL Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now