#Command as op

1 messages · Page 1 of 1 (latest)

summer helm
#

can anyone tell me why this won't work


on death of player:
    if {region.checkpoint} is 1:
        make player execute command "/desti warp dirt" as op
minor crown
#

Also you should probably use a list

lyric carbonBOT
#

Maddie suggests that you read this embed

List Variables
Why?

List variables are a much cleaner way of storing multiple values, especially objects that are unique to something (the money of a player, the warps of the server), as they can be looped, added to, removed from, accessed, and deleted all at once, making variable organization a breeze. A list basically maps objects to their corresponding unique indices.

How to create a list variable?

To make a list, we simply use the list variable separator :: in the variable's name: {money::%uuid of player%}, {warps::%{_warpName}%}, {luckyNumbers::*}.
For example:

set {_list::*} to 1, 2, 3, and 4
set {list::%uuid of player%} to player```
Indices and values

As already mentioned, lists have indices and values. For instance, in set {money::%uuid of player%} to 100 the index is the uuid of the player and the value is 100. We can also access all the values at once by using ::*. This last part means we can replace a lot of common loops with simple lists, like send "You're on team red!" to {team-red::*} instead of looping through all players and checking if each one is on team red.

Common situations which can use lists instead
{%player%.money} -> {money::%player's uuid%}
{home.warps.%player%} -> {warps::%player's uuid%::home}
{%player%.cooldown} -> {cooldown::%player's uuid%}```
summer helm
#

i did earlier in the code but i didn't send that part

summer helm
minor crown
#

You can op the player

#

Then deop the player

#

Bad idea though

sterile summit
#

why not teleport them with skript

minor crown
#

That would work perfectly

#

i did earlier in the code but i didn't send that part

#

They could teleport them using an effect instead of a command

summer helm
#

i guess

#

it's just easier with the command

minor crown
#

You can always use

#

teleport player to {loc}

#

Instead of making a command

#

Commands are like rip off functions 😭😭

summer helm
#

this still won't work

on death of player:
    if {region.checkpoint} is 1:
        teleport victim to -11.150, 115, 62.420
    ```
minor crown
#

You could also set a variable to a location, and teleport them to that variable

summer helm
#

oh wait i found the problem

#

nvm

#

on region enter:
if region is "dirtcity":
set {region.checkpoint} to 1
if region is "corruptioncity":
set {region.checkpoint} to 2
if region is "glassciv":
set {region.checkpoint} to 3
if region is "grove":
set {region.checkpoint} to 4
if region is "magmaciv":
set {region.checkpoint} to 5
if region is "mininglv1":
set {region.checkpoint} to 6
if region is "watertown":
set {region.checkpoint} to 7

on death of player:
if {region.checkpoint} is 1:
teleport victim to location at -11.150, 115, 62.420 in world "world"

sterile summit
#

these vars arent player specific

#

meaning everyone will share a checkpoint...

#

also

lyric carbonBOT
#

x8ight suggests that you read this embed

Formatting Code In Discord
Why?

Code blocks make it easier for helpers to identify potential errors -- help them help you!

The Format

```vb
on chat:
broadcast "This is how you format code!"
```

How It Looks
on chat:
    broadcast "This is how you format code!"
Extra Info

On US keyboards, the grave character (`) is located above the tab key on the top left of the keyboard

summer helm
#

oh

#

now do i make it player restrictive again?

urban sorrel
#

{var.%player%} or {var::%player%}

minor crown
#

{var::%player's uuid%}

lyric carbonBOT
#

Maddie suggests that you read this embed

List Variables
Why?

List variables are a much cleaner way of storing multiple values, especially objects that are unique to something (the money of a player, the warps of the server), as they can be looped, added to, removed from, accessed, and deleted all at once, making variable organization a breeze. A list basically maps objects to their corresponding unique indices.

How to create a list variable?

To make a list, we simply use the list variable separator :: in the variable's name: {money::%uuid of player%}, {warps::%{_warpName}%}, {luckyNumbers::*}.
For example:

set {_list::*} to 1, 2, 3, and 4
set {list::%uuid of player%} to player```
Indices and values

As already mentioned, lists have indices and values. For instance, in set {money::%uuid of player%} to 100 the index is the uuid of the player and the value is 100. We can also access all the values at once by using ::*. This last part means we can replace a lot of common loops with simple lists, like send "You're on team red!" to {team-red::*} instead of looping through all players and checking if each one is on team red.

Common situations which can use lists instead
{%player%.money} -> {money::%player's uuid%}
{home.warps.%player%} -> {warps::%player's uuid%::home}
{%player%.cooldown} -> {cooldown::%player's uuid%}```