Solved Help in making PvP game

  • 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.

SpeedBlock

Member
Jan 26, 2017
22
1
0
21
Hello guys. I need help in this code

code_language.skript:
            if arg-1 is "join":
                if {pvp.game} is false:
                    set {pvp.join::%executor%} to player
                    add 1 to {pvpplayers}
                    set {pvp.join::%executor%} to true
                    send "&7%player% &cEntró a la partida"

if {pvpplayers} is equal to 2:   
        broadcast "{@logo} &cEl juego empieza en 5 segundos !"
        wait 5 seconds

Error:

 
Code error line 20

code_language.skript:
command /pvpw [<text>]:
    permission: pvp.use
    trigger:
        world is {@worlds}:
            if {pvp.join::%executor%} is true:
                send "&cYa estas en la partida !"
                stop
               
            if {pvp.game} is true:
                send "&cLa partida está en curso !"
                stop
               
            if arg-1 is "join":
                if {pvp.game} is false:
                    set {pvp.join::%executor%} to player
                    add 1 to {pvpplayers}
                    set {pvp.join::%executor%} to true
                    send "&7%player% &cEntró a la partida"

if {pvpplayers} is 2:  
        broadcast "{@logo} &cEl juego empieza en 5 segundos !"
        wait 5 seconds
       
        set {pvp.game} to true
        make {pvp::*} execute "/pvpkit"
       
        teleport {pvp::*} to {pvp.spawn}
 
Last edited by a moderator:
Code error line 20

code_language.skript:
command /pvpw [<text>]:
    permission: pvp.use
    trigger:
        world is {@worlds}:
            if {pvp.join::%executor%} is true:
                send "&cYa estas en la partida !"
                stop
              
            if {pvp.game} is true:
                send "&cLa partida está en curso !"
                stop
              
            if arg-1 is "join":
                if {pvp.game} is false:
                    set {pvp.join::%executor%} to player
                    add 1 to {pvpplayers}
                    set {pvp.join::%executor%} to true
                    send "&7%player% &cEntró a la partida"

if {pvpplayers} is 2: 
        broadcast "{@logo} &cEl juego empieza en 5 segundos !"
        wait 5 seconds
      
        set {pvp.game} to true
        make {pvp::*} execute "/pvpkit"
      
        teleport {pvp::*} to {pvp.spawn}
An if statement can't be placed alone like that. What are you trying to do?
 
Code error line 20

code_language.skript:
command /pvpw [<text>]:
    permission: pvp.use
    trigger:
        world is {@worlds}:
            if {pvp.join::%executor%} is true:
                send "&cYa estas en la partida !"
                stop
              
            if {pvp.game} is true:
                send "&cLa partida está en curso !"
                stop
              
            if arg-1 is "join":
                if {pvp.game} is false:
                    set {pvp.join::%executor%} to player
                    add 1 to {pvpplayers}
                    set {pvp.join::%executor%} to true
                    send "&7%player% &cEntró a la partida"

if {pvpplayers} is 2: 
        broadcast "{@logo} &cEl juego empieza en 5 segundos !"
        wait 5 seconds
      
        set {pvp.game} to true
        make {pvp::*} execute "/pvpkit"
      
        teleport {pvp::*} to {pvp.spawn}
You need to add a worlds option at the top. You are testing for a variable that doesn't exist.
 
Options:
  • code_language.skript:
    options:
        logo: "&7[&6PvP&7] > "
        worlds: "Lobby"
        gameend: "&cJuego acabado !"
        joinmessage: "&c%player% &fEntró a la partida !"
        gamealreadystarted: "&cLa partida está en curso !"
        alreadyjoined: "Ya estas en la partida !"
        startamount: 2
        winamount: 2
Code:
  • code_language.skript:
    command /pvpw [<text>]:
        permission: pvp.use
        trigger:
            world is {@worlds}:
                if {pvp.join::%executor%} is true:
                    send "&cYa estas en la partida !"
                    stop
                    
                if {pvp.game} is true:
                    send "&cLa partida está en curso !"
                    stop
                    
                if arg-1 is "join":
                    if {pvp.game} is false:
                        set {pvp.join::%executor%} to player
                        add 1 to {pvpplayers}
                        set {pvp.join::%executor%} to true
                        send "&7%player% &cEntró a la partida"       
    
    if {pvpplayers} is equal to {@startamount}:   #Here is the error
            broadcast "{@logo} &cEl juego empieza en 5 segundos !"
            wait 5 seconds
            
            set {pvp.game} to true
            make {pvp::*} execute "/pvpkit"
            
            teleport {pvp::*} to {pvp.spawn}
 
  • Like
Reactions: BrettPlayMC
Options:
  • code_language.skript:
    options:
        logo: "&7[&6PvP&7] > "
        worlds: "Lobby"
        gameend: "&cJuego acabado !"
        joinmessage: "&c%player% &fEntró a la partida !"
        gamealreadystarted: "&cLa partida está en curso !"
        alreadyjoined: "Ya estas en la partida !"
        startamount: 2
        winamount: 2
Code:
  • code_language.skript:
    command /pvpw [<text>]:
        permission: pvp.use
        trigger:
            world is {@worlds}:
                if {pvp.join::%executor%} is true:
                    send "&cYa estas en la partida !"
                    stop
                    
                if {pvp.game} is true:
                    send "&cLa partida está en curso !"
                    stop
                    
                if arg-1 is "join":
                    if {pvp.game} is false:
                        set {pvp.join::%executor%} to player
                        add 1 to {pvpplayers}
                        set {pvp.join::%executor%} to true
                        send "&7%player% &cEntró a la partida"       
    
    if {pvpplayers} is equal to {@startamount}:   #Here is the error
            broadcast "{@logo} &cEl juego empieza en 5 segundos !"
            wait 5 seconds
            
            set {pvp.game} to true
            make {pvp::*} execute "/pvpkit"
            
            teleport {pvp::*} to {pvp.spawn}
:emoji_astonished: amazing!
 
You need some event to start that condition. Something like
code_language.skript:
every 3 seconds:
    if {pvpplayers} is equal to {@startamount}:  
            broadcast "{@logo} &cEl juego empieza en 5 segundos !"
            wait 5 seconds
Hope it works!
 
Status
Not open for further replies.