Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public bool trap = false;
- public static void UseItem(Player player, int playerID) {
- float targetID = 0;
- float num = -1f;
- for (int i = 0; i < 255; i++)
- {String name = player.name;
- if (Main.player[i].active && Main.player[i].name != "name")
- {
- float player1xcenter=Main.player[i].position.X +(float)(Main.player[i].width/2);
- float player1ycenter=Main.player[i].position.Y+(float)(Main.player[i].height/2);
- if (num == -1f || Math.Abs( player1xcenter) + Math.Abs(player1ycenter) < num)
- {
- num = Math.Abs(player1xcenter) + Math.Abs(player1ycenter);
- targetID = i;
- float targetx = Main.player[i].position.X;
- float targety = Main.player[i].position.Y;
- player.position.X = targetx;
- player.position.Y = targety;
- }
- }
- }
- if (targetID < 0 || targetID >= 255)
- {
- targetID = 0;
- }
- }
- public RightClick()
- {
- for (int i = 0; i < 255; i++)
- {
- if (Main.player[i].active)
- {
- float X = player.position.X;
- float Y = player.position.Y;
- Main.player[i].position.X = X;
- Main.player[i].position.Y = Y;
- }
- }
- }
- public void HoldStyle(Player player)
- {
- if(Main.mouseRight)
- {
- if(!this.trap)
- {
- this.trap = true;
- RightClick();
- }
- }
- else
- {
- this.trap = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement