Solved Chat sends twice (skript)

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

Coookie

Member
Jan 31, 2017
4
0
0
44
function ccs(p: player , m: text) :: number:
if {cookie.overidechat} is true:
if {cookie.disguise.%{_p}%} is set:
set {_player} to {cookie.disguise.%{_p}%}
else:
set {_player} to {_p}
set {_text} to {_m}
if {cookie.rank.%{_player}%} is not set:
set {cookie.rank.%{_player}%} to ""
replace all " fuck ", " bitch " and " ass " with "****" in {_m}
on chat:
cancel event
loop all players:
message "%{cookie.rank.%{_player}%}%&e%{_player}% &f%{_m}%" to loop-player
return -1
else:
stop

thats my code but the message, messages the player twice
upload_2017-1-31_20-17-47.png
 
First of all, please read this tutorial:
https://forums.skunity.com/threads/how-to-get-help-faster.284/

and I don't get that code at all, why the return is after the function?

the return function makes it so that the normal minecraft chat does not appear

code_language.skript:
function ccs(p: player , m: text) :: number:
    if {cookie.overidechat} is true:
        if {cookie.disguise.%{_p}%} is set:
            set  {_player} to {cookie.disguise.%{_p}%}
        else:
            set {_player} to {_p}
            set {_text} to {_m}
        on chat:
            cancel event
        if {cookie.rank.%{_player}%} is not set:
            set {cookie.rank.%{_player}%} to ""
        broadcast "%{cookie.rank.%{_player}%}%&e%{_player}% &f%{_m}%"
        return -1
        stop
    else:
        stop

and is that better?
 
it can't work, it's impossible because that's not how Skript works. I'll ask, what are you trying to do?

basically, the code is supposed to do
code_language.skript:
broadcast "%{cookie.rank.%{_player}%}%&e%{_player}% &f%{_m}%"
which instead of using the default chat format with no player rank it uses this

so instead of using minecraft chat it uses this as its chat
 
Last edited by a moderator:
Status
Not open for further replies.