1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Speed modifier

Discussion in 'Development' started by minijaham, Nov 10, 2020.

  1. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Hello, I've been trying to change the speed of the player without an effect.

    I did some research and found out that apparently, you can modify the movement with something called Attribute.

    However, I am not sure if I did the code correctly(coded it like how it is in current PMMP's source code) but it doesn't seem to work.

    My code:
    PHP:
    public function speedTestModifier(PlayerRespawnEvent $event) : void {
            
    $player $event->getPlayer();
            if (
    $player->isOp()) {
                
    $attr $player->getAttributeMap()->getAttribute(Attribute::MOVEMENT_SPEED);
                
    $attr->setValue($attr->getValue() * (2));
            }
        }
    Am I missing something?

    Edit: No errors are shown in the console. The code just doesn't work.
     
  2. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
  3. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Oh, I see. Thank you :D
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.