Advertisement
  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. NycuRO
    Offline

    NycuRO Active Member

    Joined:
    Oct 19, 2015
    Posts:
    64
    Minecraft User:
    NycuRK
    • 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);
    $radius = 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);
    $p = $center->add($v->normalize()->multiply($radius));
    $particle->setComponents($p->x, $p->y, $p->z);
    $level->addParticle($particle);
    }
    }
    }
    }
  2. NycuRO
    Offline

    NycuRO Active Member

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

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    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->2$yaw += (M_PI 2) / 20$y += 20){
                
    $x = -sin($yaw);
                
    $z cos($yaw);
                
    $particle->setComponents($x$y$z);
                
    $level->addParticle($particle);
            }
        }
    }
    }
    Last edited: Apr 18, 2016
    applqpak likes this.
  4. NycuRO
    Offline

    NycuRO Active Member

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

    NycuRO Active Member

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

    Primus Notable Member

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

    Nawaf_Craft1b Active Member Plugin Developer

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

    NycuRO Active Member

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

    Attached Files:

  9. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    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 :D

    Last edited: Apr 18, 2016
  10. NycuRO
    Offline

    NycuRO Active Member

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

    NycuRO Active Member

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

    Primus Notable Member

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

    NycuRO Active Member

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

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    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. NycuRO
    Offline

    NycuRO Active Member

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

    HotFireyDeath Notable Member Plugin Developer

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

    NycuRO Active Member

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

    NycuRO Active Member

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

    NycuRO Active Member

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

    Nawaf_Craft1b Active Member Plugin Developer

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

Share This Page

Advertisement