SkatCh Posted July 13, 2014 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 . Failure is simply an opportunity to begin again more intelligently - Henry Ford
MTA Team botder Posted July 13, 2014 MTA Team Posted July 13, 2014 Use the ACL to stop players accessing the commands - they shouldn't have access by default. GitHub: Debug Console • MTA-Discord Relay Scripting: How to draw a line chart with DirectX functions? • Doppler Effect in MTA • Get the client's FPS • Customizable Blur Shader
SkatCh Posted July 13, 2014 Author Posted July 13, 2014 how because i edit ACLgroups , i delete Admin , moderator , etc .. and i changed them with Head Staff > trial Staff . Failure is simply an opportunity to begin again more intelligently - Henry Ford
Max+ Posted July 13, 2014 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 .. - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
xXMADEXx Posted July 13, 2014 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 ) The Ultimate Lua Tutorial! | MTA PHP SDK
SkatCh Posted July 13, 2014 Author 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 . Failure is simply an opportunity to begin again more intelligently - Henry Ford
Max+ Posted July 13, 2014 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 - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
Recommended Posts