how I can use teleport to a variable on a function?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Mich7272

Member
Apr 12, 2019
49
0
0
23
skript: 2.4 beta
spigot: 1.14.1
mc: 1.14.1
console error:
[20:39:24] [Server thread/INFO]: [Skript] Reloading vd.sk...
[20:39:26] [Server thread/ERROR]: Variables cannot be used here. (vd.sk, line 392: teleport the {_p} to {pspawn.%{_arena}%}')
[20:39:26] [Server thread/INFO]: [Skript] Encountered 1 error while reloading vd.sk!

Code:
function kits(p: player, kit: string, arena: string):
    reset({_p})
    wait 0.1 seconds
    if {_kit} is "healer":
        set {dinero.%{_p}%} to 10
        set {mboost.%{_p}%} to 1
        set {vd::%{_p}%} to true
        set {healer.%{_p}%} to true
        set slot 0 of {_p} to wooden sword named "&cSanador" with lore "&a&oClick derecho" and "&a&oSana 3 corazones"
        set slot 1 of {_p} to 10 carrot
        set slot 2 of {_p} to 2 steak
        set slot 8 of {_p} to emerald named "&aTienda"
        wait 0.1 second
        teleport the {_p} to {pspawn.%{_arena}%}
Code:
            if arg 2 is "pspawn":
                if arg 3 is set:
                    if {arena::%arg 3%} is not set:
                        message "{@logo} Arena ""%arg 3%"" no existe"
                    else:
                        set {pspawn.%arg 3%} to the player's location
                        message "{@logo} Spawn de jugadores establecido en la localizacion ""%player's location%"""
                else:
                    message "{@logo}/vd set psawn arena"
Code:
function menu(p: player, arena: string):
    open virtual chest inventory with size 1 named "{@logo}" to {_p}
    make a gui slot 0 of {_p} with black stained glass pane named "&f" to do nothing
    make a gui slot 1 of {_p} with white stained glass pane named "&f" to do nothing
    make a gui slot 2 of {_p} with black stained glass pane named "&f" to do nothing
    make a gui slot 3 of {_p} with white stained glass pane named "&f" to do nothing
    make a gui slot 4 of {_p} with wooden sword named "&l&cSanador" with lore "&9&oTu habilidad sana", "&9&o3 corazones" and "&9&odelay 2 minutos" to close then run function healer({_p}, "healer", "{_arena}")
    make a gui slot 5 of {_p} with white stained glass pane named "&f" to do nothing
    make a gui slot 6 of {_p} with black stained glass pane named "&f" to do nothing
    make a gui slot 7 of {_p} with white stained glass pane named "&f" to do nothing
    make a gui slot 8 of {_p} with barrier named "&l&9Cerrar menu" to close
Code:
on rightclick on a sign:
    if line 1 of event-block is "&9&l[&c&oVD&9&l]":
        set {_s} to uncoloured line 2 of event-block
        if {pspawn.%{_s}%} is not set:
            message "{@logo}Lo siento pero esta arena no tiene un spawn de jugadores aun"
        else:
            menu(player, "%{_s}%")
This is what I want. To teleport the player to {pspawn.village} (village the name of the arena line 2 of the sign)
but again I have this console error how do I teleport the player to {pspawn.village}
20:39:24] [Server thread/INFO]: [Skript] Reloading vd.sk...
[20:39:26] [Server thread/ERROR]: Variables cannot be used here. (vd.sk, line 392: teleport the {_p} to {pspawn.%{_arena}%}')
[20:39:26] [Server thread/INFO]: [Skript] Encountered 1 error while reloading vd.sk!
 
skript: 2.4 beta
spigot: 1.14.1
mc: 1.14.1
console error:
[20:39:24] [Server thread/INFO]: [Skript] Reloading vd.sk...
[20:39:26] [Server thread/ERROR]: Variables cannot be used here. (vd.sk, line 392: teleport the {_p} to {pspawn.%{_arena}%}')
[20:39:26] [Server thread/INFO]: [Skript] Encountered 1 error while reloading vd.sk!

Code:
function kits(p: player, kit: string, arena: string):
    reset({_p})
    wait 0.1 seconds
    if {_kit} is "healer":
        set {dinero.%{_p}%} to 10
        set {mboost.%{_p}%} to 1
        set {vd::%{_p}%} to true
        set {healer.%{_p}%} to true
        set slot 0 of {_p} to wooden sword named "&cSanador" with lore "&a&oClick derecho" and "&a&oSana 3 corazones"
        set slot 1 of {_p} to 10 carrot
        set slot 2 of {_p} to 2 steak
        set slot 8 of {_p} to emerald named "&aTienda"
        wait 0.1 second
        teleport the {_p} to {pspawn.%{_arena}%}
Code:
            if arg 2 is "pspawn":
                if arg 3 is set:
                    if {arena::%arg 3%} is not set:
                        message "{@logo} Arena ""%arg 3%"" no existe"
                    else:
                        set {pspawn.%arg 3%} to the player's location
                        message "{@logo} Spawn de jugadores establecido en la localizacion ""%player's location%"""
                else:
                    message "{@logo}/vd set psawn arena"
Code:
function menu(p: player, arena: string):
    open virtual chest inventory with size 1 named "{@logo}" to {_p}
    make a gui slot 0 of {_p} with black stained glass pane named "&f" to do nothing
    make a gui slot 1 of {_p} with white stained glass pane named "&f" to do nothing
    make a gui slot 2 of {_p} with black stained glass pane named "&f" to do nothing
    make a gui slot 3 of {_p} with white stained glass pane named "&f" to do nothing
    make a gui slot 4 of {_p} with wooden sword named "&l&cSanador" with lore "&9&oTu habilidad sana", "&9&o3 corazones" and "&9&odelay 2 minutos" to close then run function healer({_p}, "healer", "{_arena}")
    make a gui slot 5 of {_p} with white stained glass pane named "&f" to do nothing
    make a gui slot 6 of {_p} with black stained glass pane named "&f" to do nothing
    make a gui slot 7 of {_p} with white stained glass pane named "&f" to do nothing
    make a gui slot 8 of {_p} with barrier named "&l&9Cerrar menu" to close
Code:
on rightclick on a sign:
    if line 1 of event-block is "&9&l[&c&oVD&9&l]":
        set {_s} to uncoloured line 2 of event-block
        if {pspawn.%{_s}%} is not set:
            message "{@logo}Lo siento pero esta arena no tiene un spawn de jugadores aun"
        else:
            menu(player, "%{_s}%")
This is what I want. To teleport the player to {pspawn.village} (village the name of the arena line 2 of the sign)
but again I have this console error how do I teleport the player to {pspawn.village}
20:39:24] [Server thread/INFO]: [Skript] Reloading vd.sk...
[20:39:26] [Server thread/ERROR]: Variables cannot be used here. (vd.sk, line 392: teleport the {_p} to {pspawn.%{_arena}%}')
[20:39:26] [Server thread/INFO]: [Skript] Encountered 1 error while reloading vd.sk!
The problem is that you can't use `the` before variables (in most cases)
 
Status
Not open for further replies.