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!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MundoSK Packets

Discussion in 'Tutorials' started by Tlatoani, Feb 2, 2017.

  1. a

    aeim Active Member

    Joined:
    Feb 21, 2017
    Messages:
    38
    Likes Received:
    4
    Hi, do you know the code to set the name of a scoreboard from "on packet event play_server_scoreboard_display_objective:" in a var ?
    i had try some %string% with "Name, Score Name, ..." with no result. I have only the position of the scoreboard (=sidebar)
    exemple : set {_n::*} to "name" pinfo 0 of event-packet
    I try to fix a multi addon conflict with scoreboard. thx :emoji_grinning:
     
  2. Kamino_Ramos

    Kamino_Ramos Member

    Joined:
    Feb 1, 2017
    Messages:
    18
    Likes Received:
    1
    I don't know exact code, but I suggest you send desired packet to player and broadcast its fields. Way I found most of needed fields was like this using MundoSK:

    Code (Skript):
    1. on packet event play_server_entity_metadata:
    2.     pinfo 0 %pinfo 0 of event-packet%"
    3.    broadcast "int pnum 0 %int pnum 0 of event-packet%"
    4.    broadcast "byte pnum 0 %byte pnum 0 of event-packet%"
    5.    broadcast "byte pnum 1 %byte pnum 1 of event-packet%"
    6.    broadcast "byte pnum 2 %byte pnum 2 of event-packet%"
    7.    broadcast "byte pnum 3 %byte pnum 3 of event-packet%"
    8.    broadcast "byte pnum 4 %byte pnum 4 of event-packet%"
    9.    broadcast "byte pnum 5 %byte pnum 5 of event-packet%"
    And like this, using Skellett:

    Code (Skript):
    1. on packet:
    2.     if event-string is "PacketPlayOutEntityMetadata":
    3.         set {_a} to packet field "a"
    4.         set {_b} to packet field "b"
    5.         set {_c} to packet field "c"
    6.         set {_d} to packet field "d"
    7.         set {_e} to packet field "e"
    8.         set {_f} to packet field "f"
    9.         set {_g} to packet field "g"
    10.         set {_h} to packet field "h"
    11.         broadcast "A:%{_a}% B:%{_b}% C:%{_c}% D:%{_d}% E:%{_e}% F:%{_f}% G:%{_g}% H:%{_h}%
    You can then set {_var} to packet field "X", if you know desired field is "X". Or you can write me scoreboard command that will send desired packet to player, so I can read it for you.
     
  3. Pikachu

    Moderator Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    125
    Medals:
    Code (Skript):
    1. on packet:
    2.   event-string is "PacketPlayOutEntityMetadata"
    3.   loop split "abcdefghijklmnopqrstuvwxyz" at "":
    4.     add "%loop-value%: %packet field loop-value%" to {_l::*}
    5.   broadcast {_l::*}
    if you'd like it more concise, but mundosk packets are better
     
  4. Snow-Pyon

    Moderator Resource Staff

    Joined:
    Jan 25, 2017
    Messages:
    1,233
    Likes Received:
    172
    Medals:
    Splitting it that way adds a space in the list. And knowing LimeGlass, that might thow a NPE if the field doesn't exist.
     
  5. Pikachu

    Moderator Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    125
    Medals:
    Code (Skript):
    1. on packet:
    2.   event-string is "PacketPlayOutEntityMetadata"
    3.   loop split "abcdefghijklmnopqrstuvwxyz" at "" where [string input is not " "]:
    4.     add "%loop-value%: %packet field loop-value%" to {_l::*}
    5.   broadcast {_l::*}
    then
     
  6. a

    aeim Active Member

    Joined:
    Feb 21, 2017
    Messages:
    38
    Likes Received:
    4

    Hi, this is great (but "on packet" is broken for me, i use MundoSK so it's not a problem)
    Sorry, in fact I had a correct code from the beginning but the identifier of the scoreboard was "sidebar" so I thought I had wrong. I am stupid ^^

    Here is the code to do scoreboard client side without addon as Umbaska (with color and spacebar support):


    Code (Skript):
    1. #on packet event play_server_scoreboard_objective:
    2. #    broadcast "<cyan>%string pinfo 0 of event-packet%"
    3. #    broadcast "<yellow>%string pinfo 1 of event-packet%"
    4. #    set string pinfo 1 of event-packet to "test"
    5. on packet event play_server_scoreboard_score:
    6.     #broadcast "<yellow>%string pinfo 0 of event-packet%"
    7.     #broadcast "<white>%string pinfo 1 of event-packet%"
    8.     set {_text} to string pinfo 0 of event-packet
    9.     replace all "_" with " " in {_text}
    10.     set string pinfo 0 of event-packet to "%{_text}%"
    11. on packet event play_server_scoreboard_display_objective:
    12.     #broadcast "int pnum 0 <yellow>%int pnum 0 of event-packet%"
    13.     #broadcast "<cyan>%string pinfo 0 of event-packet%"
    14.     #broadcast "%event-player%"
    15.     if  "%string pinfo 0 of event-packet%" does not contain "%event-player%":
    16.         cancel event
    17.  
    18. function ScoreboardCreate(p: player, name: string):
    19.     execute console command "/scoreboard objectives add %{_p}% dummy %{_name}%"
    20.     execute console command "/scoreboard objectives setdisplay sidebar %{_p}%"
    21. function ScoreboardReset(p: player):  
    22.     execute console command "/scoreboard objectives remove %{_p}%"
    23. function ScoreboardSet(p: player, id: number, text: string):
    24.     replace all " " with "_" in {_text}
    25.     execute console command "/scoreboard players set %{_text}% %{_p}% %{_id}%"
     
  7. J

    Jequxm Member

    Joined:
    Jul 28, 2018
    Messages:
    1
    Likes Received:
    0
  8. A

    AhmetDS Member

    Joined:
    Jul 11, 2017
    Messages:
    5
    Likes Received:
    0
    convert this to skript

    Code (Text):
    1. for (Player p : Bukkit.getOnlinePlayers())
    2.          {
    3.            PacketPlayOutEntityEffect eff = new PacketPlayOutEntityEffect(p.getPlayer().getEntityId(), new MobEffect(MobEffectList.fromId(24), 10, 1, true, true));
    4.            ((CraftPlayer) p).getHandle().playerConnection.sendPacket(eff);
    5.          }
     
  9. BrettPlayMC

    Supporter

    Joined:
    Jan 26, 2017
    Messages:
    711
    Likes Received:
    53
    Most of us are using script because we don’t know java. What does that do?
     
  10. Emerald tip

    Emerald tip Member

    Joined:
    Jul 16, 2019
    Messages:
    4
    Likes Received:
    0
    What do you need to make this work on 1.14? I have skript version 2.3.7 AAnd It gives me this beautiful error:
    Code (Text):
    1.  can't understand this event: 'on packet' (Chairs.sk, line 22: on packet:')
     
  11. Kamino_Ramos

    Kamino_Ramos Member

    Joined:
    Feb 1, 2017
    Messages:
    18
    Likes Received:
    1
    MundoSK will not work for packets on 1.14, but the developer kindly shared with me snapshot of his upcoming addon ProtocolSK, you may ask him in discord to share it with you as well. It works perfectly so far.
     
  12. L

    LeRevenant789 Member

    Joined:
    Mar 24, 2017
    Messages:
    1
    Likes Received:
    0
    Hello, I would need help with a packet. (spigot 1.8.8)
    play_client_block_dig, i have location pinfo 0 of event-packet but I'm not that :emoji_frowning::
    [​IMG]
     
    #152 LeRevenant789, Sep 6, 2019
    Last edited: Sep 6, 2019
  13. Tlatoani

    Addon Developer

    Joined:
    Jan 24, 2017
    Messages:
    151
    Likes Received:
    89
    Medals:
    Not sure exactly what you're asking, but the first one is int pnum 0 of event-packet and the last one is byte pnum 0 of event-packet.
     
Loading...