Location radius

Discussion in 'Plugin Development' started by BeeT, Jan 5, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    BeeT

    Hello everybody, I need help with location radius script.

    Here is my location radius code:

    Code:
                  int x = -16;
                  int y = 72;
                  int z = 270;
                  int radius = 5;
                  double distance = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2));
                  if (distance <= radius)
                      System.out.println("PLAYER SPAWNED IN SAFE LOCATION");
                  else
                      System.out.println("PLAYER SPAWNED IN UNSAFE LOCATION");
    
    I don' know why but it's always false...
    Server says that i spawned in unsafe location but really i'm in safe location...

    Can you help me?
     
  2. Offline

    feildmaster

    location.distance(location) <= limit
     
  3. Offline

    BeeT

    Thank you for reply but i don't understand about what limit you say...
     
  4. Offline

    CptSausage

    You are not calculation any distance. Where is you second point?
    Code:
    Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2));
     
  5. Offline

    BeeT

    I need to increase this coordinates radius:
    int x = -16; int y = 72; int z = 270;
    Now i should stay at -16 72 270 but i want to make -16 to -11 72 to 77 and 270 to 275
    +5 radius how to make it?
     
Thread Status:
Not open for further replies.

Share This Page