Function cant compare passed text to "string"

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

TrapsterDK

Member
Apr 15, 2019
2
0
0
19
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)
 
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)
You put percentege symbol, remove it or put
Code:
if "%{_c}%" = #values
[doublepost=1556133061,1556132876][/doublepost]In your code you put:
code_language.skript:
if %{_c}%
change to
code_language.skript:
if {_c}
#or
if "%{_c}%"
 
Status
Not open for further replies.