#How can we add a teleport request system when argument 1 is set?

1 messages · Page 1 of 1 (latest)

crimson cedar
#

set {_arguement} to argument 1 (line 3)

this is a local variable, and so it will only be able to be accessed in the place it is created (the command), and not in your on inventory click: event.

#

if event-slot is 10:

I would not check the slots because right now I have no idea what the item is. for additional context and ease just check the name or NBT

#

i would also use skript to create kits

supple blaze
#

@crimson cedar Thank You. Sir I want to make a teleport request system when player does /arena player it open the following gui and when it is clicked the player gets sent a teleport request and upon accepting it the player gets teleported.

supple blaze
#

@crimson cedar Can you tell how to make it a global one?

crimson cedar
supple blaze
#

and the player who gets the request has option of accepting it and rejecting it.

supple blaze
#

Got it sir?

#
    trigger:
        set {argument} to argument 1
        set {_arena} to chest inventory with 3 rows named "&1&lPrivate Arenas"
        set slot integers from 0 to 26 of {_arena} to black stained glass pane named " "
        set slot 10 of {_arena} to netherite sword named "&6&lNetherite Pot" with lore "&o&bClick To Teleport" with all flags hidden
        set slot 12 of {_arena} to diamond axe named "&6&lAxe & Shield" with lore "&o&bClick To Teleport" with all flags hidden
        set slot 14 of {_arena} to end crystal named "&6&lCrystal PvP" with lore "&o&bCLick To Teleport" with all flags hidden
        set slot 16 of {_arena} to diamond sword named "&6&lTank" with lore "&o&bClick To Teleport" with all flags hidden
        open {_arena} to player

on inventory click:
    if name of event-inventory is "&1&lPrivate Arenas":
        if event-item is black stained glass pane:
            cancel event
            
        if event-slot is 10:
            if player has permission "private.arena.netheritepot":
                if {argument} is not set:
                    clear inventory of player
                    clear all the potion effects of player
                    heal player
                    execute console command "easykits give NetheritePot %player%"
                    teleport player to {netheritespawn}
                    cancel event
                if {argument} is set:
                    clear inventory of {argument}
                    clear all the potion effects of {argument}
                    heal {argument}
                    execute console command "easykits give NetheritePot %{argument}%"
                    teleport {argument} to {netheritespawn}
                    cancel event
                    close inventory of player
            else:
                send "&cYou don't have the permission to use this."
                close inventory of player```

Here's what I have coded it works but I want a teleport system as mentioned above.
crimson cedar
#

also, if you just use {argument} this variable can only ever hold 1 value; if another uses the command before the argument accepts it will mess things up

supple blaze
supple blaze
#

any fix for this sir?

crimson cedar
#

you can set it per player; {something::%player's uuid%}, but you could also use metadata in this scenario

#

also please turn off reply pings

supple blaze
#

oh I am sorry for the pings

#

i thought you are cool with it

#

sorry, my bad.

crimson cedar
supple blaze
#

The last point is not accurate

#

Person A can be alone in arena too

#

it is not exactly like a /duel

supple blaze
#

But it might lead to abuse of perms at Person A can force tp Person B

#

that's why I need a teleport request system.

crimson cedar
#

So Person A will always be able to enter themselves at any time

supple blaze
#

Yes Sir.

#

And that can be done using the current skript as I mentioned

#

but I need a tp request system sir.

crimson cedar
#

I would set a metadata tag for the argument;

  set (Person A)'s metadata tag "arenaRequest" to (Person B)

Person B accepts/declines request:
  accept:
    set (Person A)'s metadata tag "arenaAccepted" to (Person A)'s metadata tag "arenaRequest"
                                                     # = Person B
    delete (Person A)'s metadata tag "arenaRequest"
  decline:
    delete (Person A)'s metadata tag "arenaRequest"

Teleport them:
  teleport (Person A)
  if (Person A)'s metadata tag "arenaRequest is set:
    teleport (Person A)'s metadata tag "arenaRequest"
             # = Person B
    delete (Person A)'s metadata tag "arenaRequest"```
supple blaze
#

where can I learn about metadata tag sir?

crimson cedar
#
supple blaze
#

huh i am not able to get it

crimson cedar
#

theyre basically a variable

#

you can store s thing

supple blaze
#

Can you please help me add it.

supple blaze
#

Do I need to make a separate command for it?

crimson cedar
#

to accept? a command is probably the best way to do that

supple blaze
crimson cedar
#

person A specifies the arena when they send the request?

supple blaze
#

Person A can use /arena Person B which opens a gui in which options for various arenas will be there

supple blaze
#

but I need an arena tp request

crimson cedar
#

okay, so i guess when they click on it you should keep track of the arena

#

and make the metadata tag reflect that

supple blaze
#

Keep track of the inventory slot right?

crimson cedar
#

or the name

supple blaze
#
            if player has permission "private.arena.netheritepot":
                set metadata tag "netheritepot" of player to true
                if {argument} is not set:
                    clear inventory of player
                    clear all the potion effects of player
                    heal player
                    execute console command "easykits give NetheritePot %player%"
                    teleport player to {netheritespawn}
                    cancel event
                if {argument} is set:
                    if {argument} is online:
                        clear inventory of {argument}
                        clear all the potion effects of {argument}
                        heal {argument}
                        execute console command "easykits give NetheritePot %{argument}%"
                        teleport {argument} to {netheritespawn}
                        cancel event
                        close inventory of player```
#

like this metadata tag?

crimson cedar
#

You arent using metadata, still using a variable

crimson cedar
#

But you could also use a variable if you prefer that

supple blaze
#
    trigger:
        set {argument} to argument 1
        if {argument} is not player:
            set {_arena} to chest inventory with 3 rows named "&1&lPrivate Arenas"
            set slot integers from 0 to 26 of {_arena} to black stained glass pane named " "
            set slot 10 of {_arena} to netherite sword named "&6&lNetherite Pot" with lore "&o&bClick To Teleport" with all flags hidden
            set slot 12 of {_arena} to diamond axe named "&6&lAxe & Shield" with lore "&o&bClick To Teleport" with all flags hidden
            set slot 14 of {_arena} to end crystal named "&6&lCrystal PvP" with lore "&o&bCLick To Teleport" with all flags hidden
            set slot 16 of {_arena} to diamond sword named "&6&lTank" with lore "&o&bClick To Teleport" with all flags hidden
            open {_arena} to player
        else:
            send "&cYou cannot send teleport request to yourself."

on inventory click:
    if name of event-inventory is "&1&lPrivate Arenas":
        if event-item is black stained glass pane:
            cancel event
            
        if event-slot is 10:
            if player has permission "private.arena.netheritepot":
                if {argument} is not set:
                    clear inventory of player
                    clear all the potion effects of player
                    heal player
                    execute console command "easykits give NetheritePot %player%"
                    teleport player to {netheritespawn}
                    cancel event
                if {argument} is set:
                    if {argument} is online:
                        send "&bYou sent a teleport request to %{argument}%" to player
                        send "&bYou received a teleport request from %player% for Netherite Pot Arena" to {argument}
                        send "<tooltip:&aClick to Accept.>&a&lAccept" to {argument}
                        send "<tooltip:&cClick to Reject.>&c&lReject" to {argument}
                        close inventory of player
                        cancel event
                    else:
                        send "&cPlayer is not online"
                        close inventory of player
                        cancel event
            else:
                send "&cYou don't have the permission to use this."
                close inventory of player
                cancel event```
#

I have done this what next sir?

spare aurora
#

why do u set a valuble to argument 1 just use arg 1

supple blaze
#

It was showing errors when I used arg-1 and it asked me to use argument 1 instead

#

I think it was due to SkBee

spare aurora
#

what no skbee wil not ask u to make a valuble insted of useing arg-1

supple blaze
#

hmm I see

#

But when i was using args-1 it asked to use argument instead

spare aurora
#

i wanna see

#

bro u deleted half of the messages

#

where is the rest

supple blaze
#

Oh I updated the skript that's why

supple blaze
spare aurora
#

yeah thats the lates skript u made its not the error where it says it wants a valuble

supple blaze
#

I need a solution for the teleport system

spare aurora
#

i was never saying u are lying i just think u dont know how to read an error

#

this wil work

supple blaze
#

Also I need to use a global variable

#

For which I added {argument}

spare aurora
#

u do not need a global variable or a local variable to say arg-1

#

and if u only have 1 argument u can just use arg

supple blaze
#

I will try to send the error

spare aurora
#

and u can just remove the if event-item is black stained glass pane: u dont want them to be ablel to get all the other stuff out

#

yeah

#

args-1 is not a thing

#

without the s

supple blaze
#

ohhhhhhh

#

that's why

#

I see

spare aurora
#

u can just cancel event after checking if the name is name

supple blaze
#

Thanks for helping sir.

supple blaze
spare aurora
supple blaze
#

ohhh

#

I get it sir. Thanks!

#
    trigger:
        set {argument} to arg-1
        if {argument} is not player:
            set {_arena} to chest inventory with 3 rows named "&1&lPrivate Arenas"
            set slot integers from 0 to 26 of {_arena} to black stained glass pane named " "
            set slot 10 of {_arena} to netherite sword named "&6&lNetherite Pot" with lore "&o&bClick To Teleport" with all flags hidden
            set slot 12 of {_arena} to diamond axe named "&6&lAxe & Shield" with lore "&o&bClick To Teleport" with all flags hidden
            set slot 14 of {_arena} to end crystal named "&6&lCrystal PvP" with lore "&o&bCLick To Teleport" with all flags hidden
            set slot 16 of {_arena} to diamond sword named "&6&lTank" with lore "&o&bClick To Teleport" with all flags hidden
            open {_arena} to player
        else:
            send "&cYou cannot send teleport request to yourself."

on inventory click:
    if name of event-inventory is "&1&lPrivate Arenas":
        cancel event
            
        if event-slot is 10:
            if player has permission "private.arena.netheritepot":
                if {argument} is not set:
                    clear inventory of player
                    clear all the potion effects of player
                    heal player
                    execute console command "easykits give NetheritePot %player%"
                    teleport player to {netheritespawn}

                if {argument} is set:
                    if {argument} is online:
                        send "&bYou sent a teleport request to %{argument}%" to player
                        send "&bYou received a teleport request from %player% for Netherite Pot Arena" to {argument}
                        send "<tooltip:&aClick to Accept.>&a&lAccept" to {argument}
                        send "<tooltip:&cClick to Reject.>&c&lReject" to {argument}
                        close inventory of player

                    else:
                        send "&cPlayer is not online"
                        close inventory of player

            else:
                send "&cYou don't have the permission to use this."
                close inventory of player
#

There's the updated skript sir.

spare aurora
#

but yeah if u want your tp requst thing to be in a gui u can do it with a variable with value of arg

#

but pls make it the players only like {request::%uuid of player%}

#

and like x8ight sayed its a good ider to make your own kit system with skript bc doing it from console command wil spam your console

spare aurora
#

ok i was just reading all the other texts in here and i was playing with metadata bc i normaly dont use it but now i know how to use it.

so want i wil do is make a new text argument on your arana so it wil be command /arena [<text>] [<player>]: and maybe makeing the permission on the command so they are not just opening a gui they can do anything with

supple blaze
#

Sir if possible can you please add that to my current skript?

#

Like the metadata and stuff I have no idea to to put them and use it.

crimson cedar
#

Can just set metadata/var on inv click

supple blaze
#
    trigger:
        set {argument} to argument 1
        if {argument} is not player:
            set {_arena} to chest inventory with 3 rows named "&1&lPrivate Arenas"
            set slot integers from 0 to 26 of {_arena} to black stained glass pane named " "
            set slot 10 of {_arena} to netherite sword named "&6&lNetherite Pot" with lore "&o&bClick To Teleport" with all flags hidden
            set slot 12 of {_arena} to diamond axe named "&6&lAxe & Shield" with lore "&o&bClick To Teleport" with all flags hidden
            set slot 14 of {_arena} to end crystal named "&6&lCrystal PvP" with lore "&o&bCLick To Teleport" with all flags hidden
            set slot 16 of {_arena} to diamond sword named "&6&lTank" with lore "&o&bClick To Teleport" with all flags hidden
            open {_arena} to player
        else:
            send "&cYou cannot send teleport request to yourself."

on inventory click:
    if name of event-inventory is "&1&lPrivate Arenas":
        cancel event
            
        if event-slot is 10:
            if player has permission "private.arena.netheritepot":
                if {argument} is not set:
                    clear inventory of player
                    clear all the potion effects of player
                    heal player
                    execute console command "easykits give NetheritePot %player%"
                    teleport player to {netheritespawn}

                if {argument} is set:
                    if {argument} is online:
                        send "&bYou sent a teleport request to %{argument}%" to player
                        send "&bYou received a teleport request from %player% for Netherite Pot Arena" to {argument}
                        send "<tooltip:&aClick To Accept><command:>&aAccept <reset>&bor<reset> <tooltip:&cClick To Deny><command:>&cDeny" to {argument}
                        close inventory of player

                    else:
                        send "&cPlayer is not online"
                        close inventory of player

            else:
                send "&cYou don't have the permission to use this."
                close inventory of player
#

x8ight I want to add some effects when player clicks on the text "<tooltip:&aClick To Accept><command:>&aAccept <reset>&bor<reset> <tooltip:&cClick To Deny><command:>&cDeny"

#

How can I do that?

crimson cedar
#

i think theres a way to make the player execute a command, but i don't remember it off the top of my head

supple blaze
#

yes player can execute a command

crimson cedar
supple blaze
#

Yes.

crimson cedar
#

yeah, this shows how

supple blaze
#

But that's only for command

crimson cedar
#

i suppose you could just make a command that give the effects

supple blaze
#

effects like clear inventory etc etc

crimson cedar
#

honestly since youre doing that twice i would use a function

supple blaze
#

Twice?

#

Where?

#

I think I will have to add a teleport system only like /tpa

crimson cedar
#

literally the same

#

a function would save lines and make it easier

supple blaze
supple blaze
#

@crimson cedar Sorry for the ping but dm?

small hull
#
    if name of event-inventory is "&1&lPrivate Arenas":
        cancel event
            
        if event-slot is 10:
            if player has permission "private.arena.netheritepot":
                if {argument} is not set:
                    clear inventory of player
                    clear all the potion effects of player
                    heal player
                    execute console command "easykits give NetheritePot %player%"
                    teleport player to {netheritespawn}

                if {argument} is set:
                    if {argument} is online:
                        set {atp::netherite::%uuid of player%} to true
                        set {atp::axe&shield::%uuid of player%} to false
                        set {atp::cpvp::%uuid of player%} to false
                        set {atp::tank::%uuid of player%} to false
                        close inventory of player```
#

Will this work @spare aurora ?

spare aurora
#

maybe? if u dont ping it wil maybe

small hull
#

I lost my account @supple blaze 😦

#

Oh Sorry!

spare aurora
#

try it

crimson cedar
#

you made another post so i though it was solved there

small hull
#

Oh Yeah

#

I thought u dropped out of this

small hull
#

THANK YOU GUYS!

small hull
#

The Skript works sometimes only

#

Please help.

crimson cedar
small hull
#

Can you please check if there are any errors coz they aren't getting flagged and the skript is working sometimes only.

#

Here's the skript.

#

I think it is probably related to my metadata tags.

#

But please check sir.

crimson cedar
#

this takes up a lot of space, i would just do something likecommand setspawn <string>: trigger: set {spawn::%arg-1%} to block at player's location
using the block is a quick way to get perfect coords for the centre of the block and yaw/pitch of 0

#

You still have the {argument} but it's not player-specifc.

crimson cedar
small hull
#

How can I specify then?

crimson cedar
#

The uuid in the variable or metadata

small hull
#

Will this work?

crimson cedar
#

probably

small hull
small hull
#

Here's the skript with changes. Can you please tell me what's the error?

small hull
#

Any solution to this?

crimson cedar
#

have you debugged?

small hull
#

I tried but idk how to

#

I am noob at this 😦

#

Here's the problem

#

So sometimes it works [player sends tp request player receives and player accept] but sometimes [player sends tp request but it sends multiple like of different arenas and player isn't able to accept it like player clicks on the accept button but it doesn't do anything]
Like in this case it worked!

#

But in this case, It sent request of some other arena too and the accept button didn't work

crimson cedar
#

you can employ else ifs

#

instead of just ifs

#

and i wouldnt loop all very second

small hull
#

So when Player A clicks on the gui to select an arena to send a teleport request to Player B, it sets value of for example {arena::netherite::uuid of player%] to true for the Player A