Solved Chat JSON?

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

aseald

Supporter
Jan 26, 2017
17
3
3
Category:
Chat
Suggested name:
Anything really I'm just interested in the function.
What I want:
So I've seen on other servers where when player's chat you can hover over their name tags/name to see some information on the player and I'd like to add this to my server. On my server all staff will have the same tag that reads [Staff] and I would like this to show their roles on the server. Also I have a leveling skript that I've been working on so it would be nice to show the level variable along with balance on hover.

Ideas for commands:
/roles [<add/remove>] <text>
/roles [<offlineplayer>]

Ideas for permissions:
prefix.add.roles
prefix.remove.roles
When I'd like it by: Within a week but the sooner the better. Heck I'd be grateful if someone even attempted this for me.
 
Category:
Chat
Suggested name:
Anything really I'm just interested in the function.
What I want:
So I've seen on other servers where when player's chat you can hover over their name tags/name to see some information on the player and I'd like to add this to my server. On my server all staff will have the same tag that reads [Staff] and I would like this to show their roles on the server. Also I have a leveling skript that I've been working on so it would be nice to show the level variable along with balance on hover.

Ideas for commands:
/roles [<add/remove>] <text>
/roles [<offlineplayer>]

Ideas for permissions:
prefix.add.roles
prefix.remove.roles
When I'd like it by: Within a week but the sooner the better. Heck I'd be grateful if someone even attempted this for me.
What is the display variable from your leveling script?
 
Could just do something like

code_language.skript:
on chat:
    cancel event
    loop all players:
            if player is op:
                json("%loop-player%","blah blah||ttp: enter hover info|| %player% %message")
            else:
                json ("%loop-player%","blah")
 
Could just do something like

code_language.skript:
on chat:
    cancel event
    loop all players:
            if player is op:
                json("%loop-player%","blah blah||ttp: enter hover info|| %player% %message")
            else:
                json ("%loop-player%","blah")
Yeah that works.
I thought that syntax was broken after 1.8
[doublepost=1489618633,1489618561][/doublepost]Cannot find your skype :/
No it isn't. Also you need json.sk
 
Could just do something like

code_language.skript:
on chat:
    cancel event
    loop all players:
            if player is op:
                json("%loop-player%","blah blah||ttp: enter hover info|| %player% %message")
            else:
                json ("%loop-player%","blah")
Is it possible to modify the message itself instead of change it from the message to a json?
I use PurpleIRC that broadcast the in-game messages to IRC but it doesn't hooks into json and broadcast messages.
Do you know a workaround for it? Thanks!
[doublepost=1490381514,1490221316][/doublepost]You guys know? Snow-Pyon YoshYz
 
Is it possible to modify the message itself instead of change it from the message to a json?
I use PurpleIRC that broadcast the in-game messages to IRC but it doesn't hooks into json and broadcast messages.
Do you know a workaround for it? Thanks!
[doublepost=1490381514,1490221316][/doublepost]You guys know? Snow-Pyon YoshYz

You could try to cancel the chat packet and modify it
 
if you cancel "on chat:" you cancel sending the message
if you cancel "on packet event play_server_chat:" you cancel recieving the message

code_language.skript:
on packet event play_server_chat:
    set {_jsonText} to "%""chatcomponent"" pjson 0 of event-packet%"
    execute console command "/tellraw %player% %{_jsonText}%

Note that this will crash your Server, it's just an example.
 
if you cancel "on chat:" you cancel sending the message
if you cancel "on packet event play_server_chat:" you cancel recieving the message

code_language.skript:
on packet event play_server_chat:
    set {_jsonText} to "%""chatcomponent"" pjson 0 of event-packet%"
    execute console command "/tellraw %player% %{_jsonText}%

Note that this will crash your Server, it's just an example.
I don't get it. Why it crashes the server?