1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

# Spiral Help code

Comments in 'Plugin Development' started by NycuRO, Apr 18, 2016.

1. Offline

### NycuROActive Member

Joined:
Oct 19, 2015
Posts:
64
Minecraft User:
• Can help me ? I don't know is wrong in code..

<?php

namespace nycuro;

use pocketmine\level\particle\HeartParticle;
use pocketmine\level\Position;
use pocketmine\level\Location;
use pocketmine\math\Vector3;
use pocketmine\plugin\PluginBase;
use pocketmine\event\player\PlayerMoveEvent;

class Main extends PluginBase{

public function spiral(PlayerMoveEvent \$event) {
\$player = \$event->getPlayer();
if (\$player instanceof Player) {
if (\$player->getInventory()->getItemInHand()->getId() == 351) {
\$center = new Vector3(1, 1, 1);
\$count = 100;
\$particle = new HeartParticle(\$center);
for(\$yaw = 0; \$i < \$count; \$i++){
\$pitch = (mt_rand() / mt_getrandmax() - 0.5) * M_PI;
\$yaw = mt_rand() / mt_getrandmax() * 2 * M_PI;
\$y = -sin(\$pitch);
\$delta = cos(\$pitch);
\$x = -sin(\$yaw) * \$delta;
\$z = cos(\$yaw) * \$delta;
\$v = new Vector3(\$x, \$y, \$z);
\$particle->setComponents(\$p->x, \$p->y, \$p->z);
}
}
}
}
2. Offline

### NycuROActive Member

Joined:
Oct 19, 2015
Posts:
64
Minecraft User:
Or what is \$i...... Need define \$i for function plugin..
3. Offline

### PrimusNotable Member

Joined:
Apr 7, 2015
Posts:
1,465
Minecraft User:
PHP:
``` public function spiral(PlayerMoveEvent \$event) {\$player = \$event->getPlayer();if (\$player instanceof Player) {    if (\$player->getInventory()->getItemInHand()->getId() == 351) {        // Center I assume is player position        \$radius = 1;        \$count = 100;        \$particle = new HeartParticle(\$player);         // \$yaw is in radians        for(\$yaw = 0, \$y = \$center->y; \$y < \$center->y + 2; \$yaw += (M_PI * 2) / 20; \$y += 1 / 20){            \$x = -sin(\$yaw);            \$z = cos(\$yaw);            \$particle->setComponents(\$x, \$y, \$z);            \$level->addParticle(\$particle);        }    }}} ```
Last edited: Apr 18, 2016
applqpak likes this.
4. Offline

### NycuROActive Member

Joined:
Oct 19, 2015
Posts:
64
Minecraft User:
Is fully codem
5. Offline

### NycuROActive Member

Joined:
Oct 19, 2015
Posts:
64
Minecraft User:
It's fully?
6. Offline

### PrimusNotable Member

Joined:
Apr 7, 2015
Posts:
1,465
Minecraft User:
Yes, it should work. Just copy and replace the player move event code.
applqpak likes this.
7. Offline

### Nawaf_Craft1bActive MemberPlugin Developer

Joined:
May 8, 2015
Posts:
232
Plugins:
1
Minecraft User:
Do you Want Spiral For Player If Yes
PHP:
``` \$center = new Vector3(\$player-x,\$player->y,\$player->z); ```
8. Offline

### NycuROActive Member

Joined:
Oct 19, 2015
Posts:
64
Minecraft User:
Not work.

File size:
191.5 KB
Views:
26
File size:
197.7 KB
Views:
31
9. Offline

### PrimusNotable Member

Joined:
Apr 7, 2015
Posts:
1,465
Minecraft User:
Ehmm, sorry you are not using PocketMine, please look for furthermore help on software's official forums

P.S. It's simple PHP syntax error there is nothing to do with PocketMine anyway

Last edited: Apr 18, 2016
10. Offline

### NycuROActive Member

Joined:
Oct 19, 2015
Posts:
64
Minecraft User:
Can help pls?
11. Offline

### NycuROActive Member

Joined:
Oct 19, 2015
Posts:
64
Minecraft User:
I'm use pocketmine. -name softwark- is for test.
12. Offline

### PrimusNotable Member

Joined:
Apr 7, 2015
Posts:
1,465
Minecraft User:
You are using Genesys and I said previously it's a silly error that can be fixed really easy
13. Offline

### NycuROActive Member

Joined:
Oct 19, 2015
Posts:
64
Minecraft User:
And ,how fix error syntax?
14. Offline

### CraftYourBukkitNotable MemberPlugin Developer

Joined:
Jan 20, 2015
Posts:
1,022
Plugins:
2
Minecraft User:
http://lmgtfy.com/?q=where can I learn php
You either learn PHP and come back if you are able to fix (simple) errors yourself or you don't come back. You simply copied that code without even thinking one second about it. This forum is not there to copy stuff, it's there to learn stuff. Yes, those are two different things. You don't learn from copying. Do you know this one sentence..

Learning by doing.
15. Offline

### NycuROActive Member

Joined:
Oct 19, 2015
Posts:
64
Minecraft User:
16. Offline

### HotFireyDeathNotable MemberPlugin Developer

Joined:
Mar 19, 2015
Posts:
328
Plugins:
1
Minecraft User:
More like you are too lazy to find out yourself.
applqpak likes this.
17. Offline

### NycuROActive Member

Joined:
Oct 19, 2015
Posts:
64
Minecraft User:
It is not idle, but do not know so much English and nobody can explain to me what this or that means . @HotFireyDeath
18. Offline

### NycuROActive Member

Joined:
Oct 19, 2015
Posts:
64
Minecraft User:
Thanks...i'm rezolved... :/
19. Offline

### NycuROActive Member

Joined:
Oct 19, 2015
Posts:
64
Minecraft User:
But i need to add to level,no player move..
20. Offline

### Nawaf_Craft1bActive MemberPlugin Developer

Joined:
May 8, 2015
Posts:
232
Plugins:
1
Minecraft User:
Do You Mean Particle Evrey sec ! i donot undrstand???