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.

Function cant compare passed text to "string"

Discussion in 'Skript' started by TrapsterDK, Apr 24, 2019.

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

    TrapsterDK Member

    Joined:
    Apr 15, 2019
    Messages:
    2
    Likes Received:
    0
    i am trying to make chatcolor but there is some error in the function i have when i am trying to compare a argument passed to the function with text the argument is passed as text
    would be nice if anyone can help me ty

    Skript: newest 2.3

    function Error:
    Can't compare "%{_c}% with a text (if %{_c}% is equal to "&a", "&b", "&a", "&c", "&d", "&e", "&f", "&0", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9", "&k", "&l", "&m", "&n" or "&o":emoji_slight_smile:

    function changecc(c: text, p: player):
    replace all "$" with "&" in {_c}
    if %{_c}% is equal to "&a", "&b", "&a", "&c", "&d", "&e", "&f", "&0", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9", "&k", "&l", "&m", "&n" or "&o":
    set {chatcolor.%{_p}%} to %{_c}%
    else if %{_c}% is equal to "&k", "&l", "&m", "&n" or "&o":
    set {chatcolor2.%{_p}%} to {_c}
    else if {_c} is equal to "&r":
    set {chatcolor.%{_p}%} to ""
    set {chatcolor2.%{_p}%} to ""

    Command no error:

    command /chatcolor <text> [<player>]:
    aliases: chatc, ccolor, cchat
    usage: /chatcolor <color> [<player>]
    permission: sk.chatcolor
    permission message: &b[&9ChatColor&b] &cYou do not have this permission
    trigger:
    if arg 2 is not set:
    changecc(arg 1, command sender)
    else:
    changecc(arg 1, arg 2)
     
  2. couger44

    Supporter

    Joined:
    Feb 19, 2017
    Messages:
    714
    Likes Received:
    31
    You put percentege symbol, remove it or put
    Code (Text):
    1. if "%{_c}%" = #values
    --- Double Post Merged, Apr 24, 2019, Original Post Date: Apr 24, 2019 ---
    In your code you put:
    Code (Skript):
    1.  
    2. if %{_c}%
    3.  
    change to
    Code (Skript):
    1.  
    2. if {_c}
    3. #or
    4. if "%{_c}%"
    5.  
     
Thread Status:
Not open for further replies.

Share This Page

Loading...