inFluenceiV

Sample warn script

Jul 15th, 2014
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. kick: 'warn',
  2. k: 'warn',
  3. warn: function (target, room, user) {
  4. if (!target) return this.parse('/help warn');
  5.  
  6. target = this.splitTarget(target);
  7. var targetUser = this.targetUser;
  8. if (!targetUser || !targetUser.connected) {
  9. return this.sendReply("User " + this.targetUsername + " not found.");
  10. }
  11. if (room.isPrivate && room.auth) {
  12. return this.sendReply("You can't warn here: This is a privately-owned room not subject to global rules.");
  13. }
  14. if (target.length > MAX_REASON_LENGTH) {
  15. return this.sendReply("The reason is too long. It cannot exceed " + MAX_REASON_LENGTH + " characters.");
  16. }
  17. if (!this.can('warn', targetUser, room)) return false;
  18.  
  19. this.addModCommand("" + targetUser.name + " was warned by " + user.name + "." + (target ? " (" + target + ")" : ""));
  20. targetUser.send('|c|~|/warn ' + target);
  21. this.add('|unlink|' + this.getLastIdOf(targetUser));
  22. },
Advertisement
Add Comment
Please, Sign In to add comment