duel skript

Discussion in 'Skript help' started by Mich2, Apr 17, 2017.

  1. Mich2

    Mich2 New Member

    Joined:
    Apr 14, 2017
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    I need help with my duel 1 vs 1 skript no error its just some times the player leave the duel and the arena still open and no one can duel how I do like If someone of the duel leave drop the inventory wait like 30 second and the enemy can have time to take the stuff of the guy wh leave and close the arena and teleport the player to {ffa.lobby}. here is the code. Thanks



    Code:
    options:
        logo: &9[&bEnder&aTheth&9]
    command /duelo <player> [<text>] [<text>] [<text>] [<text>]:
        usage: /duelo (jugador) lo que quieras decirle breve y es opcional
        trigger:
            if {duelo.%player%} is "si":
                send "{@logo}Ya as retado a alguien espera"
                stop
            else:
                if {duelo.%player%} is not set:
                    send "{@logo}&aEsperando por %arg-1%" to the player
                    send "{@logo}&aTiene 30 segundos para aceptar" to the player
                    send "{@logo}&a%player% quiere retarte a un duelo" to the arg-1
                    send "{@logo}&aTiene 30 segundos para aceptar" to the arg-1
                    send "{@logo}&a/dueloaceptar %player%" to the arg-1
                    set {duelo.%player%} to "si"
                    wait 30 second
                    if {duelo.%player%} is not set:
                        stop
                    else:
                        send "{@logo}&cDuelo cancelado"
                        delete {duelo.%player%}
                else:
                    stop
    command /dueloaceptar <player>:
        trigger:
            if {duelo.%player%} is "si":
                send "{@logo}No te puedes retar a ti mismo"
            else:
                if {duelo} is "si":
                    send "{@logo}la arena esta en uso"
                    stop
                else:
                    set {duelo} to "si"
                    teleport the player to {duelo.arena.spawn2}
                    teleport the arg-1 to {duelo.arena.spawn1}
                    set {duelo.%player%} to "si"
    on death of player:
        {duelo.%attacker%} is "si"
        {duelo.%victim%} is "si"
        teleport the attacker to {ffa.lobby}
        set {duelo} to "no"
        delete {duelo.%victim%}
        delete {duelo.%attacker%}
    on join:
        delete {duelo.%player%}
    command /aduelo <text> <text>:
        permission: admin
        permission message: {@logo} Este plugin es original de nosotros y no tienes acceso a este comando
        trigger:
            if arg-1 is "spawn":
                if arg-2 is "1":
                    set {duelo.arena.spawn1} to the player's location
                    send "{@logo}Spawn 1"
                if arg-2 is "2":
                    set {duelo.arena.spawn2} to the player's location
                    send "{@logo}spawn 2"
                if arg-2 is "reset":
                    set {duelo} to "no"
     
  2. diamondpumpkin

    diamondpumpkin PSL Owner/Administrator Staff Member

    Joined:
    May 1, 2016
    Messages:
    671
    Likes Received:
    46
    Trophy Points:
    28
    Gender:
    Male
    Occupation:
    PSL
    Location:
    Places, Ukraine
    Home Page:
    Hello,
    I see your problem, you don't have a logout detection system, if you think about it, you need a way to test if the player is no longer on the server. So, I normally add the players that are in the game into a variable, then every second or so, I test if those select players are online, if they aren't I set a variable to that player saying they should be teleported to the lobby. Just be sure to remove them from the original variable after they leave, other wise you'll have problems.

    Thanks,
    diamondpumpkin. (PSL Owner/Administrator)