Last active
August 29, 2015 14:21
-
-
Save Benzi/bafa243cf09dbde2891d to your computer and use it in GitHub Desktop.
Bans all current and incoming peasants in a plug.dj community
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function() { | |
| var banning = false; | |
| function killAPI() { | |
| API.off(API.CHAT_COMMAND); | |
| } | |
| API.on(API.CHAT_COMMAND, function(command) { | |
| if (command === "/banall") { | |
| if (banning) { | |
| banning = !banning; | |
| return API.chatLog("Stopped banning."); | |
| } | |
| else { | |
| banning = !banning; | |
| return API.chatLog("Banning all peasants!"); | |
| } | |
| } | |
| if (command === "/kill") { | |
| API.chatLog("BanScript Deactivated!"); | |
| killAPI(); | |
| } | |
| }); | |
| function banPeasants() { | |
| if (banning){ | |
| var users = API.getUsers(); | |
| for (var i = 0; i < users.length; i++) { | |
| if (users[i].role < 1) { | |
| API.moderateBanUser(users[i].id, 5, API.BAN.HOUR); | |
| } | |
| } | |
| } | |
| }; | |
| function trigger() { | |
| setInterval(banPeasants, 100); | |
| } | |
| API.chatLog("BanScript Activated!"); | |
| trigger(); | |
| }()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment