Functions not working

Discussion in 'Skript' started by jamesblair0, Jul 10, 2018.

Thread Status:
Not open for further replies.
  1. Hello, I am making a Duels Skript. However, when I tried to put some code into a function named gameStart, it did not work.

    Code (Text):
    function gameStart(1: player , 2: player):
        set {_1}'s walk speed to 0
        set {_2}'s walk speed to 0
        if {duopvp.pos1} is set:
            teleport {_1} to {duopvp.pos1}
            wait 1 tick
            set {duopvp.status.{_1}.ingame} to "true"
            set {duopvp.status.{_1}.ingame.opponent} to {_2}
        if {duopvp.pos2} is set:
            teleport {_2} to {duopvp.pos2}
            wait 1 tick
            set {duopvp.status.{_2}.ingame} to "true"
            set {duopvp.status.{_2}.ingame.opponent} to {_1}
        wait 20 tick
        send "{@prefix} {@maincolor}3" to {_1}
        send "{@prefix} {@maincolor}3" to {_2}
        wait 20 tick
        send "{@prefix} {@maincolor}2" to {_1}
        send "{@prefix} {@maincolor}2" to {_2}
        wait 20 tick
        send "{@prefix} {@maincolor}1" to {_1}
        send "{@prefix} {@maincolor}1" to {_2}
        wait 20 tick
        send "{@prefix} {@maincolor}Go!" to {_1}
        send "{@prefix} {@maincolor}Go!" to {_2}
        set {_1}'s walk speed to 0.2
        set {_2}'s walk speed to 0.2
        execute console command "kit {@kit} {_1}"
        execute console command "kit {@kit} {_2}"
    Code (Text):
                else if arg 1 is "accept":
                    if arg 2 is set:
                        if arg 2 is online:
                            if {duopvp::invites::%player%::*} contains arg 2:
                                loop all players:
                                    if {duopvp.status.%loop-player%.ingame} is "true":
                                        message "{@prefix} {@playerinarena}"
                                        stop
                                send "{@prefix} {@accepted}" to arg 2
                                send "{@prefix} {@accepted_sucess}" to player
                                remove arg 2 from {duopvp::invites::%player%::*}
                                gameStart(player , argument-1 parsed as player)
                            else:
                                send "{@prefix} {@noinvite}" to player
                        else:
                            send "{@prefix} {@notonline}" to player
                    else:
                        send "{@prefix} {@error}" to player
    [​IMG]
     
  2. It's not the function. It's the variables.
    Code (Text):
    {duopvp.status.{_1}.ingame}
    You have to add percentage symbols when using expressions within variables.
    Code (Text):
    {duopvp.status.%{_1}%.ingame}
     
    • Agree Agree x 1
Thread Status:
Not open for further replies.