Advertisement
yoraimer

randomcode

Mar 21st, 2012
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. public bool trap = false;
  2.  
  3. public static void UseItem(Player player, int playerID) {
  4.  
  5. float targetID = 0;
  6. float num = -1f;
  7. for (int i = 0; i < 255; i++)
  8. {String name = player.name;
  9. if (Main.player[i].active && Main.player[i].name != "name")
  10. {
  11. float player1xcenter=Main.player[i].position.X +(float)(Main.player[i].width/2);
  12. float player1ycenter=Main.player[i].position.Y+(float)(Main.player[i].height/2);
  13.  
  14. if (num == -1f || Math.Abs( player1xcenter) + Math.Abs(player1ycenter) < num)
  15. {
  16. num = Math.Abs(player1xcenter) + Math.Abs(player1ycenter);
  17.  
  18. targetID = i;
  19. float targetx = Main.player[i].position.X;
  20. float targety = Main.player[i].position.Y;
  21.  
  22. player.position.X = targetx;
  23. player.position.Y = targety;
  24. }
  25. }
  26. }
  27. if (targetID < 0 || targetID >= 255)
  28. {
  29. targetID = 0;
  30. }
  31. }
  32.  
  33.  
  34. public RightClick()
  35. {
  36. for (int i = 0; i < 255; i++)
  37. {
  38. if (Main.player[i].active)
  39. {
  40. float X = player.position.X;
  41. float Y = player.position.Y;
  42. Main.player[i].position.X = X;
  43. Main.player[i].position.Y = Y;
  44.  
  45. }
  46. }
  47. }
  48. public void HoldStyle(Player player)
  49. {
  50. if(Main.mouseRight)
  51. {
  52. if(!this.trap)
  53. {
  54. this.trap = true;
  55. RightClick();
  56. }
  57. }
  58. else
  59. {
  60. this.trap = false;
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement