BOB Posted January 23, 2017 Share Posted January 23, 2017 Добрый день. Подскажите, как создать команду, чтобы мог использовать только администратор? Link to comment Share on other sites More sharing options...
Noah_Murray Posted January 23, 2017 Share Posted January 23, 2017 Ставь проверку на команду, администратор игрок или нет. Link to comment Share on other sites More sharing options...
cacao Posted January 23, 2017 Share Posted January 23, 2017 (edited) function isAdmin(player) { return Math.floor(Math.random() * (5 - 1)) + 1 === 4 } let commands = { "cmd": (player, param1, param2) => { if (isAdmin(player)) // code here... } } mp.events.add({ "playerCommand" => (player, args) { let [cmd, ...params] = args.split(' ') if (!commands[cmd] || typeof commands[cmd] !== 'function') return false params.unshift(player) commands[cmd].apply(this, params) } ) Edited January 23, 2017 by cacao 2 Link to comment Share on other sites More sharing options...
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