1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Funtions dont work

Discussion in 'Skript' started by Brok3nmind, Dec 21, 2018.

Thread Status:
Not open for further replies.
  1. Brok3nmind

    Brok3nmind Active Member

    Joined:
    Feb 3, 2017
    Messages:
    66
    Likes Received:
    1
    [SOLVED]

    Game version: 1.13.2
    Skript: 2.3 beta 4

    Code (Skript):
    1. command /lol:
    2.     trigger:
    3.         something(player)
    4.  
    5. function something(p: player):
    6.     loop 1 times:
    7.         loop all items in {_p}'s inventory:
    8.             if {_p} has 6 Ice:
    9.                 if {_p} has 21 Diamond:
    10.                     send "&eYou have exchanged 21 Diamonds and 6 Ice for 1x Ice Cream Sword" to {_p}
    11.                     remove 21 diamond from {_p}'s inventory
    12.                     remove 6 ice from {_p}'s inventory
    13.                     add 1 stone sword with name "&eIce Cream Sword" with lore "&7Ice Cream is good||&7I like it." to {_p}
    14.                     stop
     
    #1 Brok3nmind, Dec 21, 2018
    Last edited: Dec 21, 2018
  2. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    A function must be loaded before it is used in anyline.
     
  3. Brok3nmind

    Brok3nmind Active Member

    Joined:
    Feb 3, 2017
    Messages:
    66
    Likes Received:
    1
    Ok i did it, but i still dont work
     
  4. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    show code and errors?
     
  5. Brok3nmind

    Brok3nmind Active Member

    Joined:
    Feb 3, 2017
    Messages:
    66
    Likes Received:
    1
    Code (Skript):
    1. function something(p: player):
    2.     loop 1 times:
    3.         loop all items in {_p}'s inventory:
    4.             if {_p} has 6 Ice:
    5.                 if {_p} has 21 Diamond:
    6.                     send "&eYou have exchanged 21 Diamonds and 6 Ice for 1x Ice Cream Sword" to {_p}
    7.                     remove 21 diamond from {_p}'s inventory
    8.                     remove 6 ice from {_p}'s inventory
    9.                     add 1 stone sword with name "&eIce Cream Sword" with lore "&7Ice Cream is good||&7I like it." to {_p}
    10.                     stop
    11. command /lol:
    12.     trigger:
    13.         something(player)
    I become that https://gyazo.com/190411c66bb406f824043e089fa10126
     
  6. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    Code (Skript):
    1. function something(p: player):
    2.  if {_p} has 6 Ice:
    3.   if {_p} has 21 Diamond:
    4.    send "&eYou have exchanged 21 Diamonds and 6 Ice for 1x Ice Cream Sword" to {_p}
    5.    remove 21 diamond from {_p}'s inventory
    6.    remove 6 ice from {_p}'s inventory
    7.    add 1 stone sword with name "&eIce Cream Sword" with lore "&7Ice Cream is good||&7I like it." to {_p}
    8.  
    9. command /lol:
    10.  trigger:
    11.   something(player)
     
  7. Brok3nmind

    Brok3nmind Active Member

    Joined:
    Feb 3, 2017
    Messages:
    66
    Likes Received:
    1
    It still dont works
     
  8. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    Code (Skript):
    1. function something(p: player):
    2.  broadcast "1"
    3.  if {_p} has 6 Ice:
    4.   broadcast "2"
    5.   if {_p} has 21 Diamond:
    6.    broadcast "3"
    7.    send "&eYou have exchanged 21 Diamonds and 6 Ice for 1x Ice Cream Sword" to {_p}
    8.    remove 21 diamond from {_p}'s inventory
    9.    remove 6 ice from {_p}'s inventory
    10.    add 1 stone sword with name "&eIce Cream Sword" with lore "&7Ice Cream is good||&7I like it." to {_p}
    11.  
    12. command /lol:
    13.  trigger:
    14.   something(player)
    What does it return?
     
  9. Brok3nmind

    Brok3nmind Active Member

    Joined:
    Feb 3, 2017
    Messages:
    66
    Likes Received:
    1
    Only 1
     
  10. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    do you even have these items in your inventory XD
     
  11. Brok3nmind

    Brok3nmind Active Member

    Joined:
    Feb 3, 2017
    Messages:
    66
    Likes Received:
    1
    I have these items in my inventory, thats my problem
     
  12. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    Code (Skript):
    1. command /taaast:
    2.     trigger:
    3.         if player has 6 Ice:
    4.             message "YAHS"
    5.         else:
    6.             message "nOPE"
     
  13. Brok3nmind

    Brok3nmind Active Member

    Joined:
    Feb 3, 2017
    Messages:
    66
    Likes Received:
    1
    That says YAHS so i have
     
  14. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    mmmm weird seems like a bug try:

    Code (Skript):
    1. function something(p: player):
    2.  broadcast "1"
    3.  if "%{_p}%" parsed as a player has 6 Ice:
    4.   broadcast "2"
    5.   if "%{_p}%" parsed as a player has 21 Diamond:
    6.    broadcast "3"
    7.    send "&eYou have exchanged 21 Diamonds and 6 Ice for 1x Ice Cream Sword" to {_p}
    8.    remove 21 diamond from {_p}'s inventory
    9.    remove 6 ice from {_p}'s inventory
    10.    add 1 stone sword with name "&eIce Cream Sword" with lore "&7Ice Cream is good||&7I like it." to {_p}
    11.  
    12. command /lol:
    13.  trigger:
    14.   something(player)
     
    • Like Like x 1
  15. Brok3nmind

    Brok3nmind Active Member

    Joined:
    Feb 3, 2017
    Messages:
    66
    Likes Received:
    1
    That work, thank that you helped me!
     
    • Like Like x 1
Thread Status:
Not open for further replies.

Share This Page

Loading...