Solved How do you create a function that gives all players the input parameter?

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

Sqwwy

Member
Jun 5, 2020
2
0
0
23
So, I'm trying to create a server that gives you a random block out of some blocks every 10 seconds. Here is my code:

Code:
on join:
execute console command "/mvtp %player% game"

function all(obj: item):
  loop all players:
    give loop-player 1 {_obj}

every 10 seconds:
  set {_g} to true
  chance of 20%:
    if {_g} is true:
      set {_g} to false
      all(cobblestone)
  chance of 15%:
    if {_g} is true:
      set {_g} to false
      all(dirt)
  chance of 10%:
    if {_g} is true:
      set {_g} to false
      all(coal)
  chance of 5%:
    if {_g} is true:
      set {_g} to false
      all(iron ore)
  if {_g} is true:
    all(cobblestone)

My error is that it says "Former is neither an item type..."
If you can hel please reply :emoji_grinning:
 
So, I'm trying to create a server that gives you a random block out of some blocks every 10 seconds. Here is my code:

Code:
on join:
execute console command "/mvtp %player% game"

function all(obj: item):
  loop all players:
    give loop-player 1 {_obj}

every 10 seconds:
  set {_g} to true
  chance of 20%:
    if {_g} is true:
      set {_g} to false
      all(cobblestone)
  chance of 15%:
    if {_g} is true:
      set {_g} to false
      all(dirt)
  chance of 10%:
    if {_g} is true:
      set {_g} to false
      all(coal)
  chance of 5%:
    if {_g} is true:
      set {_g} to false
      all(iron ore)
  if {_g} is true:
    all(cobblestone)

My error is that it says "Former is neither an item type..."
If you can hel please reply :emoji_grinning:
Code:
function all(obj: item):
  loop all players:
    give {_obj} to loop-player
 
Code:
function all(obj: item):
  loop all players:
    give {_obj} to loop-player
wait hold up, I just realized I posted an old file into my panel that did a similar thing but didn't work... apparently this one does work.. sorry xD

edit: I just got rid of the "1"
 
Status
Not open for further replies.