#sending too many messages

1 messages · Page 1 of 1 (latest)

cerulean patio
#

`command /netherexit:
permission: op
trigger:
set {netherexit} to location of player
send "{@p} &7Set netherexit to %{netherexit}%"

on entering a portal:
if player is in world "spawn":
if player's inventory contains a magma cream named "&c&lNether Key":
make player execute command "/mvtp boxnether"
else:
push player backwards with speed 0.1
send "{@p} &7You need a Nether Key to enter the Nether."
stop
else:
if player is in world "boxnether":
teleport player to {netherexit}

`
i get no error but when i go through a nether portal without the key it sends like 20 messages when i only want it to send 1

cerulean patio
#

it also does not make me run the player command but i have op so i have permission to do it

acoustic thistle
#

you made sure the players have the permission for both the base command and the ability to teleport to that world?

#

because what may actually be easier for you and, in turn, simpler to do is instead use the /setworldspawn command in the world in question, then teleport player to spawn of world("your_world_here")

#

no extra commands needed

cerulean patio
#

nether exit is an admin command but yeah

acoustic thistle
#

i wasn't talking about that, I was referring to when you made the player run the /mvtp command

cerulean patio
#

yeah they have permission

acoustic thistle
#

odd. you may need to instead make the console do it, if you still want to go that route execute console command "/mv tp %player% world"

cerulean patio
#

i did that and it worked but i still get like 20 messages when i dont have the key

acoustic thistle
#

yes, because that event is called several times

cerulean patio
#

but i told it to stop

acoustic thistle
#

doesn't matter, it's a separate iteration of the code running

cerulean patio
#

so how do i make it only run once

acoustic thistle
#

set a player variable (or use metadata) that says something like "use-portal" and set it to something random or true when they get into the portal. Then the line before that check if the data there is set and if it is, stop the code.