SkatCh Posted July 13, 2014 Share Posted July 13, 2014 hi guys please can any one help me i create a script to prevent players in my server from using server command , like start , restart , refresh , etc ... but me too i can't use them : (i'm staff ) . i will explane my script it's server side scripte i create table with all MTA server commands eg : Command = { ['delaccount'] = true; } -- etc .... -- then i create this function : addEventHandler ( 'onPlayerCommand',getRootElement ( ), function ( cmd ) if Command [ cmd ] then cancelEvent ( ); kickPlayer ( source, "Command Not Allowed" ); end; end ); so my question how can i make admin will be able to use those commands i tried many exports function : like isPlayerInTeams , isPlayerStaff but i think there is something wrong , thx fro help . Link to comment
MTA Team botder Posted July 13, 2014 MTA Team Share Posted July 13, 2014 Use the ACL to stop players accessing the commands - they shouldn't have access by default. Link to comment
SkatCh Posted July 13, 2014 Author Share Posted July 13, 2014 how because i edit ACLgroups , i delete Admin , moderator , etc .. and i changed them with Head Staff > trial Staff . Link to comment
Max+ Posted July 13, 2014 Share Posted July 13, 2014 Commands = { 'start', 'stop', 'refresh', 'banPlayer', 'delaccount' } addEventHandler ( 'onPlayerCommand',getRootElement ( ), function ( nCommand ) for _, Max in ipairs ( Commands ) do if Commands [ nCommand ] and ( hasObjectPermissionTo ( source, "function.setServerPassword", false ) ) then kickPlayer ( source, "Command Not Allowed" ); end end end ) use /debugscript 3 for erros .. Link to comment
xXMADEXx Posted July 13, 2014 Share Posted July 13, 2014 Commands = { 'start', 'stop', 'refresh', 'banPlayer', 'delaccount' } addEventHandler ( 'onPlayerCommand',getRootElement ( ), function ( nCommand ) for _, Max in ipairs ( Commands ) do if Commands [ nCommand ] and ( hasObjectPermissionTo ( source, "function.setServerPassword", false ) ) then kickPlayer ( source, "Command Not Allowed" ); end end end ) use /debugscript 3 for erros .. The loop in this wouldn't work. Try using this: local commands = { ['start'] = true, ['stop'] = true, ['refresh'] = true, ['banPlayer'] = true, ['delaccount'] = true } addEventHandler ( "onPlayerCommand", root, function ( cmd ) if ( commands [ cmd:lower() ] ) then cancelEvent ( ) outputChatBox ( "This command isn't allowed in the server.", source, 255, 0, 0 ) end end ) Link to comment
SkatCh Posted July 13, 2014 Author Share Posted July 13, 2014 WTF topic can be locked some stupid answers .my script is working fine just i'm asking how to make admin able to use those command without being kicked . Link to comment
Max+ Posted July 13, 2014 Share Posted July 13, 2014 WTF topic can be locked some stupid answers .my script is working fine just i'm asking how to make admin able to use those command without being kicked . stupid answers ? your the one how blowed the acl groups ! and they will not be abel to use these commands , if they are not admin Link to comment
Recommended Posts