InFerNo_01 Posted July 3, 2012 Share Posted July 3, 2012 Hello! I've try to make a /ban command but it doesnt work. Here's my command: function banPlayerCommand ( theClient, commandName, bannedName, ... ) if hasObjectPermissionTo ( theClient, "function.kickPlayer" ) then if not ... then return outputChatBox ("#bf2e2e* Error: /aban [name] [reason]",theClient,255,255,255,true) end local reason = table.concat({...}," ") local bannerName = getPlayerName(theClient):gsub("#%x%x%x%x%x%x","") local bannedPlayer = getPlayerFromName(bannedName) if not isElement(bannedPlayer) then outputChatBox ("#bf2e2e* Error: Invalid player name!",theClient,255,255,255,true) end outputChatBox ( "#ff6666* #ff1111" ..getPlayerName(bannedPlayer):gsub("#%x%x%x%x%x%x","").. " #ff6666has been banned by " .. bannerName .. " (" ..reason.. ")", getRootElement(), 255, 0, 0, true ) banPlayer ( bannedPlayer, theClient, reason ) else outputChatBox ("#bf2e2e* Error: You are not admin!",theClient,255,255,255,true) end end addCommandHandler ( "aban", banPlayerCommand ) But it doesnt work, it displays "errors" in chat box like "You are not an admin" but when I do like "/aban inferno test" it always says "Invalid player name", and not my ban announce and the ban. Does someone know what did I make wrong please? PS: I also want to rename the /aban command in /ban command but I don't know how to remove the original /ban command. Thanks for helping Link to comment
micheal1230 Posted July 3, 2012 Share Posted July 3, 2012 Hello! I've try to make a /ban command but it doesnt work. Here's my command: function banPlayerCommand ( theClient, commandName, bannedName, ... ) if hasObjectPermissionTo ( theClient, "function.kickPlayer" ) then if not ... then return outputChatBox ("#bf2e2e* Error: /aban [name] [reason]",theClient,255,255,255,true) end local reason = table.concat({...}," ") local bannerName = getPlayerName(theClient):gsub("#%x%x%x%x%x%x","") local bannedPlayer = getPlayerFromName(bannedName) if not isElement(bannedPlayer) then outputChatBox ("#bf2e2e* Error: Invalid player name!",theClient,255,255,255,true) end outputChatBox ( "#ff6666* #ff1111" ..getPlayerName(bannedPlayer):gsub("#%x%x%x%x%x%x","").. " #ff6666has been banned by " .. bannerName .. " (" ..reason.. ")", getRootElement(), 255, 0, 0, true ) banPlayer ( bannedPlayer, theClient, reason ) else outputChatBox ("#bf2e2e* Error: You are not admin!",theClient,255,255,255,true) end end addCommandHandler ( "aban", banPlayerCommand ) But it doesnt work, it displays "errors" in chat box like "You are not an admin" but when I do like "/aban inferno test" it always says "Invalid player name", and not my ban announce and the ban. Does someone know what did I make wrong please? PS: I also want to rename the /aban command in /ban command but I don't know how to remove the original /ban command. Thanks for helping Mate i think this is stole because you dont even know how to change the command from /aban to /ban Link to comment
InFerNo_01 Posted July 3, 2012 Author Share Posted July 3, 2012 It's not stolen, it's server side, I just modified the command from here https://wiki.multitheftauto.com/wiki/BanPlayer and Callum helped me a little on the IRC chat but it's still not working. And I know how to change the command, I just don't know how to remove the original /ban command from MTA. I thought I needed to set the command.ban in ACL to false but it doesnt work. Please help I really tried, it's not like if i didn't do anything or steal the code. Link to comment
Callum Posted July 4, 2012 Share Posted July 4, 2012 To disable the default ban command, try changing /admin/conf/commands.xml (line 9) to EDIT: Uh, forums don't seem to like commenting a line...the '-->' should be on the same line. Link to comment
InFerNo_01 Posted July 4, 2012 Author Share Posted July 4, 2012 Works now, thanks to Callum, Remi-X and lil-toady 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