Solved Function wan't WORK. Plz check my code....T_T

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

donghan kim

New Member
Sep 7, 2018
9
0
1
27
MY code: (if applicable)

There is no error in my console, but the function does not work.

I have an error which I do not understand or I think the function is wrong, I do not know why FOREVER.

Can you tell me why a function does not work?

( My function's name is Remain(p: player, v: text) )



code_language.skript:
on leftclick with 403:
    if {animal::%player%::*} is not set:
        set {animal::%player%::cow} to 0
        set {animal::%player%::mooshrooms} to 0
        set {animal::%player%::pig} to 0
        set {animal::%player%::chicken} to 0
        set {animal::%player%::sheep} to 0
        set {animal::%player%::donkey} to 0
        set {animal::%player%::mule} to 0
        set {animal::%player%::polar} to 0
        if {maxanimal::cow} is not set:
            set {maxanimal::cow} to 10
            set {maxanimal::mooshrooms} to 10
            set {maxanimal::pig} to 10
            set {maxanimal::chicken} to 10
            set {maxanimal::sheep} to 10
            set {maxanimal::donkey} to 10
            set {maxanimal::mule} to 10
            set {maxanimal::polar} to 10
# 소 버섯소 돼지 닭 양 당나귀 노새 북극곰 순서임

    set {_animalname.%player%} to name of held item
    if {_animalname.%player%} contains "&a소 &f- spawnbook":
        cancel event
        if {animal::%player%::cow} < 10:
            remove 1 of held item from held item
            run player cmd "summon minecraft:cow" as op
            add 1 to {animal::%player%::cow}
            message "&6[MKC]&f Animal(&a&l소&f) was born!"
        else:
            message "&6[MKC]&f Animal(&a&l소&f) wasn't born!"
        message "&6[MKC]&f 소 Number of Born : %{animal::%player%::cow}%/%{maxanimal::cow}%"
        Remain(player, {animal::%player%::cow})
    if {_animalname.%player%} contains "&a버섯소 &f- spawnbook":
        cancel event
        if {animal::%player%::mooshrooms} < 10:
            remove 1 of held item from held item
            run player cmd "summon minecraft:mooshrooms" as op
            add 1 to {animal::%player%::mooshrooms}
            message "&6[MKC]&f Animal(&a&l버섯소&f) was born!"
        else:
            message "&6[MKC]&f Animal(&a&l버섯소&f) wasn't born!"
        message "&6[MKC]&f 버섯소 Number of Born : %{animal::%player%::mooshrooms}%/%{maxanimal::mooshrooms}%"
        Remain(player, {animal::%player%::mooshrooms})
    if {_animalname.%player%} contains "&a돼지 &f- spawnbook":
        cancel event
        if {animal::%player%::pig} < 10:
            remove 1 of held item from held item
            run player cmd "summon minecraft:pig" as op
            add 1 to {animal::%player%::pig}
            message "&6[MKC]&f Animal(&a&l돼지&f) was born!"
        else:
            message "&6[MKC]&f Animal(&a&l돼지&f) wasn't born!"
        message "&6[MKC]&f 돼지 Number of Born : %{animal::%player%::pig}%/%{maxanimal::pig}%"
        Remain(player, {animal::%player%::pig})
    if {_animalname.%player%} contains "&a닭 &f- spawnbook":
        cancel event
        if {animal::%player%::chicken} < 10:
            remove 1 of held item from held item
            run player cmd "summon minecraft:chicken" as op
            add 1 to {animal::%player%::chicken}
            message "&6[MKC]&f Animal(&a&l닭&f) was born!"
        else:
            message "&6[MKC]&f Animal(&a&l닭&f) wasn't born!"
        message "&6[MKC]&f 닭 Number of Born : %{animal::%player%::chicken}%/%{maxanimal::chicken}%"
        Remain(player, {animal::%player%::chicken})
    if {_animalname.%player%} contains "&a양 &f- spawnbook":
        cancel event
        if {animal::%player%::sheep} < 10:
            remove 1 of held item from held item
            run player cmd "summon minecraft:sheep" as op
            add 1 to {animal::%player%::sheep}
            message "&6[MKC]&f Animal(&a&l양&f) was born!"
        else:
            message "&6[MKC]&f Animal(&a&l양&f) wasn't born!"
        message "&6[MKC]&f 양 Number of Born : %{animal::%player%::sheep}%/%{maxanimal::sheep}%"
        Remain(player, {animal::%player%::sheep})
    if {_animalname.%player%} contains "&a당나귀 &f- spawnbook":
        cancel event
        if {animal::%player%::donkey} < 10:
            remove 1 of held item from held item
            run player cmd "summon minecraft:donkey" as op
            add 1 to {animal::%player%::donkey}
            message "&6[MKC]&f Animal(&a&l당나귀&f) was born!"
        else:
            message "&6[MKC]&f Animal(&a&l당나귀&f) wasn't born!"
        message "&6[MKC]&f 당나귀 Number of Born : %{animal::%player%::donkey}%/%{maxanimal::donkey}%"
        Remain(player, {animal::%player%::donkey})
    if {_animalname.%player%} contains "&a북극곰 &f- spawnbook":
        cancel event
        if {animal::%player%::polar} < 10:
            remove 1 of held item from held item
            run player cmd "summon minecraft:polar_bear" as op
            add 1 to {animal::%player%::polar}
            message "&6[MKC]&f Animal(&a&l북극곰&f) was born!"
        else:
            message "&6[MKC]&f Animal(&a&l북극곰&f) wasn't born!"
        message "&6[MKC]&f 북극곰 Number of Born : %{animal::%player%::polar}%/%{maxanimal::polar}%"
        Remain(player, {animal::%player%::polar})
    if {_animalname.%player%} contains "&a노새 &f- spawnbook":
        cancel event
        if {animal::%player%::mule} < 10:
            remove 1 of held item from held item
            run player cmd "summon minecraft:mule" as op
            add 1 to {animal::%player%::mule}
            message "&6[MKC]&f Animal(&a&l노새&f) was born!"
        else:
            message "&6[MKC]&f Animal(&a&l노새&f) wasn't born!"
        message "&6[MKC]&f 노새 Number of Born : %{animal::%player%::mule}%/%{maxanimal::mule}%"
        Remain(player, {animal::%player%::mule})
   
       
function Remain(p: player, v: text):
    if {_v} < 2:
        message "■□□□□□□□□□" to {_p}
    if {_v} < 3:
        if {_v} > 1:
            message "■■□□□□□□□□" to {_p}
    if {_v} < 4:
        if {_v} > 2:
            message "■■■□□□□□□□" to {_p}
    if {_v} < 5:
        if {_v} > 3:
            message "■■■■□□□□□□" to {_p}
    if {_v} < 6:
        if {_v} > 4:
            message "■■■■■□□□□□" to {_p}
    if {_v} < 7:
        if {_v} > 5:
            message "■■■■■■□□□□" to {_p}
    if {_v} < 8:
        if {_v} > 6:
            message "■■■■■■■□□□" to {_p}
    if {_v} < 9:
        if {_v} > 7:
            message "■■■■■■■■□□" to {_p}
    if {_v} < 10:
        if {_v} > 8:
            message "■■■■■■■■■□" to {_p}
    if {_v} < 11:
        if {_v} > 9:
            message "■■■■■■■■■■" to {_p}

Other Useful Info:

Addons using (including versions):
sharpSK 1.6.3
skDragon
skllett 1.9.6b
SkQuery
skRayFall
skUtilities
TuSKe
SKCompat-2.1.0
SkStuff
SkAction 2.2

Troubleshooting:
 
You're trying to use number comparisons (< and >) with a text (function Remain(p: player, v: text))
EDIT: you are calling the functions the right way, but you didn't define it right.
 
Last edited:
Status
Not open for further replies.