Solved There's no a player in a periodical event

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

Aztron

New Member
Mar 15, 2017
7
0
0
29
I want to create a Personal generator, like EggWars.
with a button to turn on/off.
I created " {spawn.%player%} " to turn on and off spawn (summon) items.
Errors on Reload:
code_language.skript:
There's no a player in a periodical event.

Code:
code_language.skript:
every 5 seconds in "world":
  if {spawn.%player%} is true:
    if {level1.%player%} is true:
      make console execute command "summon Item %{x1}% %{y1}% %{z1}% {Item:{id:264,Count:5,tag:{display:{Name:""&bDiamond"",Lore:[Diamonds & more Diamonds!]}}}}"
    else if {level2.%player%} is true:
      make console execute command "summon Item %{x1}% %{y1}% %{z1}% {Item:{id:264,Count:8,tag:{display:{Name:""&bDiamond"",Lore:[Diamonds & more Diamonds!]}}}}"
    else:
      make console execute command "summon Item %{x1}% %{y1}% %{z1}% {Item:{id:264,Count:2,tag:{display:{Name:""&bDiamond"",Lore:[Diamonds & more Diamonds!]}}}}"
 
Last edited:
You can't use "%player%" because you aren't executing it every 5 seconds. You'd have to loop all the players first.


code_language.skript:
every 5 seconds:
    loop all players:
        if loop-player is in world "world":
            if {spawn.%loop-player%} is true:
                if {level1.%loop-player%} is true:
                    console command "summon Item %{x1}% %{y1}% %{z1}% {Item:{id:264,Count:5,tag:{display:{Name:""&bDiamond"",Lore:[Diamonds & more Diamonds!]}}}}"
                else if {level2.%loop-player%} is true:
                    console command "summon Item %{x1}% %{y1}% %{z1}% {Item:{id:264,Count:8,tag:{display:{Name:""&bDiamond"",Lore:[Diamonds & more Diamonds!]}}}}"
                else:
                    console command "summon Item %{x1}% %{y1}% %{z1}% {Item:{id:264,Count:2,tag:{display:{Name:""&bDiamond"",Lore:[Diamonds & more Diamonds!]}}}}"
 
You can't use "%player%" because you aren't executing it every 5 seconds. You'd have to loop all the players first.


code_language.skript:
every 5 seconds:
    loop all players:
        if loop-player is in world "world":
            if {spawn.%loop-player%} is true:
                if {level1.%loop-player%} is true:
                    console command "summon Item %{x1}% %{y1}% %{z1}% {Item:{id:264,Count:5,tag:{display:{Name:""&bDiamond"",Lore:[Diamonds & more Diamonds!]}}}}"
                else if {level2.%loop-player%} is true:
                    console command "summon Item %{x1}% %{y1}% %{z1}% {Item:{id:264,Count:8,tag:{display:{Name:""&bDiamond"",Lore:[Diamonds & more Diamonds!]}}}}"
                else:
                    console command "summon Item %{x1}% %{y1}% %{z1}% {Item:{id:264,Count:2,tag:{display:{Name:""&bDiamond"",Lore:[Diamonds & more Diamonds!]}}}}"
It works:emoji_slight_smile:.
Thanks for the help buddy.
 
Status
Not open for further replies.