Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tagpro.ready(function() {
- // Set names here:
- var names = [
- "HappyGilmore",
- "@@@@@@@@@@@@",
- ];
- // Set trigger key code here - you can find key mappings here: https://css-tricks.com/snippets/javascript/javascript-keycodes/
- var triggerKeyCode = 78; //trigger is the "n" key
- var i = localStorage.getItem("indexForName") || 0;
- function switchName() {
- i = (i >= names.length) ? 0 : i;
- var newName = names[i] || 'error';
- tagpro.socket.emit('name', newName);
- i++;
- localStorage.setItem("indexForName", i);
- }
- document.onkeyup = function(e) {
- if (tagpro.disableControls || tagpro.spectator) {
- return;
- }
- if (e.keyCode === triggerKeyCode) {
- switchName();
- }
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement