Graal Pastebin

New Paste
Pasted on January 5, 2012.
View the raw file

function onActionServerSide() {
  switch (params[0]) {
  case "sendwarpdata":
    with(findplayer(params[3])) {
      player.x = params[1];
      player.y = params[2];
    }
    break;
  }
}
 
//#CLIENTSIDE
function onCreated() {
  this.on = 0;
  setTimer(0.05);
}
 
function onKeyPressed(code, Key) {
  if (code == 160) {
    //shift key
    if (this.on == 0) {
      this.on = 1;
      player.chat = "(Mousewarp: ON)";
    } else {
      this.on = 0;
      player.chat = "(Mousewarp: OFF)";
    }
  }
}
 
function onMouseDown(mode) {
  if (mode == "left" && this.on == 1) {
    for (temp.p: players) {
      if (mousex in | temp.p.x - 1, temp.p.x + 3 | && mousey in | temp.p.y, temp.p.y + 2 | ) {
        client.sel = p.account;
      }
      elseif(client.sel != NULL && client.sel == p.account) {
        triggerserver("gui", name, "sendwarpdata", mousex, mousey, p.account);
        client.sel = NULL;
      }
    }
  }
  if (mode == "right" && client.sel != NULL) {
    client.sel = NULL;
  }
}
 
/*
The below is just something I added so I could
identify if I have a player selected or not
It isn't vital to have this and changing
the players chat would do nicely too.
*/
 
function onTimeout() {
  if (client.sel != NULL) {
    MW_Window.visible = true;
    MW_Player.text = "Selected:" SPC client.sel;
  } else {
    MW_Window.visible = false;
  }
  setTimer(0.05);
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63