#What's the use of 'getplayers()'?

1 messages · Page 1 of 1 (latest)

prime prism
#

I'm trying to use it with 'location' property but i don't know how.. Can you send me an example? Pls.

prime prism
#

Can you show me an example code?

#

Thx

craggy aurora
#

Vector? It use Vector3 Interface

#
for (const playerAtLocation of world.getPlayers({ location: { x: 0, y: 0, z: 0 }, maxDistance: 1 })) {
    playerAtLocation.sendMessage(`You are at 0, 0, 0!`)
}
prime prism
#

This code have any error?

const $player = world.getPlayers({location new: vector($xpos1, $ypos1, $zpos1), maxDistance:1});

It tells me "," expected.

#
src/main.ts:127:44 - error TS1005: ',' expected.        
127 const $player = world.getPlayers({location new Vector($xpos1, $ypos1, $zpos1), maxDistance:1});
                                               ~~~      
src/main.ts:127:48 - error TS1005: ':' expected.

127 const $player = world.getPlayers({location new Vector($xpos1, $ypos1, $zpos1), maxDistance:1});
                                                   ~~~~~~


Found 2 errors in the same file, starting at: src/main.ts:127
#
src/main.ts:127:44 - error TS1005: ',' expected.

127 const $player = world.getPlayers({location new: Vector($xpos1, $ypos1, $zpos1), maxDistance:1});                                                           ~~~


Found 1 error in src/main.ts:127
#

Let me try

#

It compiled.