# Fly and create effect between distance..

Discussion in 'Plugin Development' started by Brexima, Apr 20, 2013.

Not open for further replies.
1. Offline

### Brexima

I have two question.
1-) how can i open/close fly for a player and he will fly max his current y high + 30..
2-) how can i create effect between target and player? im pushing player back with right click its done but i want to create 20 smoke effect between me and player like:
me----(effect)----(effect)----(effect)---...----target
i tried something like this:
Code:
for(int i=1; i<20; i++){
Double px = player.getLocation().getX() + i*((rightclick.getLocation().getX() - player.getLocation().getX())/20);
Double py = player.getLocation().getY() + i*((rightclick.getLocation().getY() - player.getLocation().getY())/20);
Double pz = player.getLocation().getZ() + i*((rightclick.getLocation().getZ() - player.getLocation().getZ())/20);
World dunya = player.getWorld();
Location pLoc = new Location(dunya,px,py,pz);
player.getWorld().playEffect(pLoc, Effect.SMOKE, 0);
}
but its not working like what i want.. thanks for helps

#1
2. Offline

### caseif

Not quite sure what you mean by the first question, but for the second, you could probably accomplish that with a bit of arithmetic. Find the x and z locations of the targets, get the difference for each axis, divide by 20, multiply by i (probably obtained from a for loop), and add the final answer to the smaller value. Of course, this could easily be done in 3D as well, simply by finding the y-axis as well.

#2
3. Offline

### Brexima

AngryNerd
if u look up i did it like u said. but it not working good. and for the first question, i want to open fly mode for a player like creative and max fly height for player must be 30.

#3
4. Offline

Okay... so have an entity movement listener (Though, I would highly suggest you find a listener that would suffice and get called less) .. Check if they're flying, and make sure they're not above your limited... job done?

#4
5. Offline

### Brexima

and how can i open fly mode in survival for a player ? and check fly effect ?

#5
6. Offline

Find out what /fly <name> does, and do that - or execute the command via console.

#6
7. Offline

### Brexima

im still searching answer for a first question.

#7
8. Offline

### TheUpdater

want to create smoke? to target

#8
9. Offline

### Wolftic

For the effect you could use the blockIterator and then on PlayerMoveEvent add the smoke?
And maybe store his Y and then check with the PlayerMoveEvent if his Y < Y(from first) + 20?

#9
10. Offline

### Brexima

TheUpdater
i want to create smoke effect between me and target. or i want to create 5 smoke effect in player's facing direction.

#10
11. Offline

### TheUpdater

compare the locations then make smoke betwene=

#11
12. Offline

### Brexima

TheUpdater
.. i did it if u look first comment but it didnt work may u give me an example please ^^'

#12