Chaos Posted August 7, 2014 Share Posted August 7, 2014 (edited) hey, im trying to ban account so if player got ban then login with another pc with same account will get ban again but i'm looking for unban event because when i want unban player then he can return to server with out ban. function outputBan ( banPointer, responsibleElement ) account = getPlayerAccount(source) if account then setAccountData(account,"AccountBanned",true) outputChatBox("The account has been banned",root,255,0,0) end end addEventHandler ( "onPlayerBan", getRootElement(), outputBan ) addEventHandler("onPlayerLogin", root, function() account = getPlayerAccount(source) if account then if getAccountData(account,"AccountBanned") == true then banPlayer ( source, false, false, true, getRootElement ( ), 'You have been banned',0 ) end end end) Edited August 7, 2014 by Guest Link to comment
Gr0x Posted August 7, 2014 Share Posted August 7, 2014 function outputBan () account = getPlayerAccount(source) if account and not isGuestAccount(account) then setAccountData(account,"AccountBanned",true) outputChatBox("The account has been banned",root,255,0,0) end end addEventHandler ( "onPlayerBan", getRootElement(), outputBan ) addEventHandler("onPlayerLogin", root, function(_,account) if getAccountData(account,"AccountBanned") == true then banPlayer ( source, false, false, true, getRootElement ( ), 'You have been banned',0 ) end end) Link to comment
Chaos Posted August 7, 2014 Author Share Posted August 7, 2014 it's worked but i'm looking for unban event because when i want unban player then he can return to server with out ban. Link to comment
Gr0x Posted August 7, 2014 Share Posted August 7, 2014 (edited) You edited the post 1 minute after i posted my code, first you said that it didn't work. Edited August 7, 2014 by Guest Link to comment
Chaos Posted August 7, 2014 Author Share Posted August 7, 2014 no mate i forget add the resource to admin group that's why i edited it. Link to comment
Gr0x Posted August 7, 2014 Share Posted August 7, 2014 Well, i won't make this one for you (I don't have time atm, sorry), but if you are using 1.4, you can use setBanReason to set the ban reason to the account name of the banned player, and use the onUnban event, get the reason with getBanReason and set the accountdata to false. There might be a much easier solution, but i can't think about it atm. Link to comment
Chaos Posted August 7, 2014 Author Share Posted August 7, 2014 (edited) function announceUnban( theBan, responsibleElement ) account = getPlayerAccount(theBan) if account then if getAccountData(account,"AccountBanned") == true then setAccountData(account,"AccountBanned",false) end end end addEventHandler( "onUnban", root, announceUnban ) --Adds the event handler for 'onUnban' thanks a lot but anything wrong here ? Edited August 7, 2014 by Guest Link to comment
Gr0x Posted August 7, 2014 Share Posted August 7, 2014 You can't get the account of a ban element, only of a player element. To do it, you have to find a way. (Like i said, set the reason to the account name.) 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