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

    feerko Member

    Joined:
    Feb 19, 2017
    Messages:
    70
    Likes Received:
    1
    Hello, i'm trying to create a citizen with per players skin, it's possible with packets?
     
  2. Pikachu

    Moderator Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    125
    Medals:
    As I explained on discord, yes it is
     
  3. f

    feerko Member

    Joined:
    Feb 19, 2017
    Messages:
    70
    Likes Received:
    1
    yes but how? i'm only know it's uses play_server_player_info packet.
     
  4. Lordcre_

    Supporter

    Joined:
    May 7, 2017
    Messages:
    22
    Likes Received:
    2
    Where at? I'm interested lol
     
  5. Pikachu

    Moderator Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    125
    Medals:
    • Like Like x 1
  6. krainser

    krainser Member

    Joined:
    Jan 27, 2017
    Messages:
    50
    Likes Received:
    3
    Hello! Nice addon!
    Im trying to solve a java bug on the 1.10.2, the problem is in the ride effect. When a player make a entity ride him it doesn't shown for the client. But for the others users shows. I read some forums and the problem can be solved in the packets that the server sends. But i dont find out wich packet i have to use and how. Im pretty new in this -packets stuff-.Could you help me? Thanks!
     
  7. Tlatoani

    Addon Developer

    Joined:
    Jan 24, 2017
    Messages:
    151
    Likes Received:
    89
    Medals:
    You can find some lists of packets at the end of the tutorial under the title “Helpful Resources”. I can’t seem to find forum threads talking about the bug you are describing so it would be good if you could send some links to these threads so I can help you further.
     
  8. K

    KeskorianHD Member

    Joined:
    Oct 13, 2017
    Messages:
    5
    Likes Received:
    0
    Hello I need Help... I am Trying to make the player getting a demo screen... Its a
    Change Game State packet with reason 5. How do i write this in skript?
     
  9. Tlatoani

    Addon Developer

    Joined:
    Jan 24, 2017
    Messages:
    151
    Likes Received:
    89
    Medals:
    This should be approximately what you need:
    Code (Skript):
    1. set {_packet} to new play_server_game_state_change packet
    2. set int pnum 0 of {_packet} to 7 #This might be byte instead of int, not sure
    3. set float pnum 0 of {_packet} to 0 #There are other possible values depending on what you want to show [URL]http://wiki.vg/Protocol#Change_Game_State[/URL]
    4. send {_packet} to {_player}
     
  10. Kamino_Ramos

    Kamino_Ramos Member

    Joined:
    Feb 1, 2017
    Messages:
    18
    Likes Received:
    1
    Hello everyone I need help with my script.

    What I need: send following packets to player
    - scoreboard team created
    - scoreboard option showFriendlyInvisibles
    - scoreboard team join of attacker (event player)
    - scoreboard team join of victim by uuid or id (can be other player or mob)
    - potion effect of invisibility applied to victim
    - scoreboard team remove

    Why packets?
    I've created script that allows players to pick up and throw mobs at each other. I want to make mobs half-transparent like ghosts for player that holds mob. Visible to other players so they be aware that this player might attack them, but half-transparent to current player, so he could aim better. And ghost so he doesn't forget that he holds someone. So I think I should use packets for this reason. Another reason, when using actual scoreboard team entities won't attack friendly player. In the end it should look like this:


    What I got so far?
    Thanks to help of Tlatoani, I've managed to make this parts of script which should work okay:

    Scoreboard team create
    Code (Skript):
    1. set {_team_add} to new play_server_scoreboard_team packet
    2. set int pnum 1 of {_team_add} to 0 # mode = team create
    3. set string pinfo 0 of {_team_add} to "%attacker%" # team name
    4. send packet {_team_add} to attacker
    Scoreboard team option - seeFriendlyInvisibles
    Code (Skript):
    1. set {_team_option} to new play_server_scoreboard_team packet
    2. set int pnum 1 of {_team_option} to 2 # team update
    3. set string pinfo 0 of {_team_option} to "%attacker%" # team name
    4. set int pnum 2 of {_team_option} to 2 # seeFriendlyInvisibles
    5. send packet {_team_option} to attacker
    Scoreboard team remove
    Code (Skript):
    1. set {_team_remove} to new play_server_scoreboard_team packet
    2. set int pnum 1 of {_team_remove} to 1 # mode = team remove
    3. set string pinfo 0 of {_team_remove} to "%player%" # team name
    4. send packet {_team_remove} to player
    What I'm failing at?
    Scoreboard team join of entity by uuid. You see, I got code above by tracking actual scoreboards, using things like:
    Code (Skript):
    1. on packet event play_server_scoreboard_team:
    2.     broadcast "%int pnum 0 of event-packet%"
    I matched every value and field with table from packetwrapper, to know what I send to player. But I can not find uuids or ids of entities being added to team. I assume it should be like "something array pinfo 0 of event-packet" to track it, since it's ListString, but how exactly to put it - I can't understand.

    Also, how do I add and remove potion effect from another entity?
     
  11. Pikachu

    Moderator Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    125
    Medals:
    This is the packet you want:
    [​IMG]
    it's the string array.
     
  12. Kamino_Ramos

    Kamino_Ramos Member

    Joined:
    Feb 1, 2017
    Messages:
    18
    Likes Received:
    1
    Okay, I think it is, but how do I put it?

    set string array pinfo 0 of event-packet to "%attacker%" ? Or attackers uuid, or json something?
     
  13. Pikachu

    Moderator Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    125
    Medals:
    like wiki.vg says, for players its the player name
     
  14. Kamino_Ramos

    Kamino_Ramos Member

    Joined:
    Feb 1, 2017
    Messages:
    18
    Likes Received:
    1
    Yea, this part I get, player name or uuid of entity, but is this proper way?
    Code (Skript):
    1. set {_team_join_a} to new play_server_scoreboard_team packet
    2. set int pnum 1 of {_team_join_a} to 3 # team add players
    3. set string pinfo 0 of {_team_join_a} to "%attacker%" # team name
    4. set string array pinfo 0 of {_team_join_a} to "%attacker%" # player to add
    5. send packet {_team_join_a} to attacker
    6.  
    7. set {_team_join_v} to new play_server_scoreboard_team packet
    8. set int pnum 1 of {_team_join_v} to 3 # team add players
    9. set string pinfo 0 of {_team_join_v} to "%attacker%" # team name
    10. set string array pinfo 0 of {_team_join_v} to "%entity uuid of victim%" # entity to add
    11. send packet {_team_join_v} to attacker
    As I see no effect in game. And packet tracker shows packets fields being sent - mode of packet (create team, remove team, add entities) but <none> in string array pinfo 0 of event-packet, no uuids or ids or names.
     
  15. Pikachu

    Moderator Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    125
    Medals:
    Nowhere does it say player name or uuid of entity, it says player name for players and uuid for other entities
     
  16. Kamino_Ramos

    Kamino_Ramos Member

    Joined:
    Feb 1, 2017
    Messages:
    18
    Likes Received:
    1
    Hm.. In this script there is check that attacker is always player, and by writing "%attacker%" I'm telling player's name. "%entity uuid of victim%" is skellett's expression, and in my tests I'm hitting sheeps and cows, so it should work, as it is working with regular scoreboards via "execute console command..." (my video). So is my code correct, assuming it's always name for player and always uuid for mobs? Coz I see no effect (regular potion effect applied to mob, and since packet is telling that we are in same team, it should be ghost?)
     
  17. Pikachu

    Moderator Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    125
    Medals:
    You're passing the string array the wrong info. read the notes for it or read what i said above
     
  18. Kamino_Ramos

    Kamino_Ramos Member

    Joined:
    Feb 1, 2017
    Messages:
    18
    Likes Received:
    1
    I could find no examples of working with string arrays and this is the very first time I need it, as I'm no java programmer or something. Do I need to pay you to get exact working code? How about, I put 5USD on your paypal and you give me code that I can copy-paste which would (1) add player and mob-entity to same team, (2) give mob-entity invisibility for given time so it can be seen as ghost only for event-player (and normal to others), (3) then remove team and (4) remove effect from entity?
     
  19. Pikachu

    Moderator Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    125
    Medals:
    I'm good. You don't need to know Java either. As far as I can tell the only issue is your passing the wrong thing. You can ignore the fact it's a string array because that isn't relevant, you're just putting into the wrong input. if you look at the wiki.vg description it explains the input you need (I'm assuming the victim is a player).
     
  20. Kamino_Ramos

    Kamino_Ramos Member

    Joined:
    Feb 1, 2017
    Messages:
    18
    Likes Received:
    1
    I'm trying to understand, how exactly I should write this line, what field to modify (for example string pinfo 0 of {_packet}), how is it called and what to feed into it, should it be plain text, or list varible or some kind of json.

    I also kept testing what fields are sent when you create, remove team and when you add someone. This is what I got with MundoSK when I tested if there is a field at all: string pinfo 0,1,2,3,4,5 were present, int pnum 0,1,2 present, string array pinfo = none of these in packet, other types of data are also absent.

    Then I thought to try out Skelletts syntax to display fields, and got this: A = team name, B = team display name, E = nameTagVisibility, F = collisionRule, H = list of players to add to the team that looks like this [player1, player2] which also may contain mob uuids, I = mode (create,remove,update teams, add players), J = options (like seeFriendlyInvisibles). But skellett (as far as I know) only reacts to actual packets that were send, and can not send them manualy.
    --- Double Post Merged, Nov 2, 2017, Original Post Date: Nov 2, 2017 ---
    Just to sum it up. Thanks to Snow-Pyon it works. What exactly helped me:

    Code (Skript):
    1. set {_team_join} to new play_server_scoreboard_team packet
    2. set int pnum 1 of {_team_join} to 3 # team add players
    3. set string pinfo 0 of {_team_join} to "%{_teamname}%"
    4. set collection array pinfo 0 of {_team_join} to "%attacker%", "%entity uuid of victim%"
    5. send packet {_team_join} to attacker
    This line in particular:
    set collection array pinfo 0 of {_packet} to "player1", "player2"
    which I could not find anywhere. Many thanks to Snow-Pyon for this :emoji_grinning:
     
Loading...