King of the hill skript: pls help

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

lkluyt

New Member
Apr 26, 2021
5
0
1
23
Can you guys help me do something.. So at the end of the timer (around line 30) I want a player to recieve $50 if they're in the region {koth}. But for some reason "loop all players" doesn't work.

Code:
#KoTH Skript
#Made by kluytanium/lkluyt

Variables:
    {game} = false
    {winner} = false

options:
    P: &4&l[KoTH]

on region enter:
    if "%event-region%" contains "koth":
        if {game} is true:
            send "{@P} &c%player% &eis capturing the hill!" to all players

on command "/runkoth":
    send "{@P} &eKoTH will begin in &a&l1 &eminute!" to all players
    wait 1 second
    send "{@P} &eKoTH has begun!" to all players
    execute console command "/rg flag spawn pvp allow"
    set {game} to true
    wait 5 seconds
    send "{@P} &a&l30 &eseconds left!" to all players
    wait 1 second
    send "{@P} &a&l5 &eseconds left!" to all players
    wait 5 seconds
    set {winner} to true
    set {game} to false

loop all players:
    if {winner} = true:
        if "%region at player%" contains "koth":
            send "{@P} &c%event-player% &eis the King of the Hill!" to all players
            execute console command "/rg flag spawn pvp deny"
            execute console command "/eco give %event-player% 50"
            set {winner} to false
        else:
            send "{@P} &eNobody won :((" to all players
            set {winner} to false
 
because you have to put a command/event
try something like this:
Code:
every second:
  loop all players:
 
But then I wouldn't be able to use %region at player% in that periodical event
 
it still says "there's no player in a periodical event"
Just try replacing everything after every second to this
Code:
every second:
    loop all players:
        if {winner} = true:
            if "%region at loop-player%" contains "koth":
                send "{@P} &c%loop-player% &eis the King of the Hill!" to all players
                execute console command "/rg flag spawn pvp deny"
                execute console command "/eco give %loop-player% 50"
                set {winner} to false
            else:
                send "{@P} &eNobody won :((" to all players
                set {winner} to false
 
Status
Not open for further replies.