Thread: [Any 317] - Sound packet

Results 1 to 10 of 10
  1. #1 [Any 317] - Sound packet 
    Registered Member Farage's Avatar
    Join Date
    Jan 2017
    Posts
    252
    Thanks given
    24
    Thanks received
    22
    Rep Power
    0
    I was doing some stuff with my Elvarg source (started a new one, old one was messed up bad). I wanted game sounds and they didnt work so here is the fixed packet. This will work for any 317, make ajustments where needed.

    Place this in PacketSender (or wherever you send your packets from)
    Code:
    public PacketSender sendSound(int id, int delay, int volume) {
    		PacketBuilder out = new PacketBuilder(174);
    		out.putShort(id);
    		out.putShort(delay);
    		out.putShort(volume);
    		player.getSession().write(out);
    		return this;		
    	}
    If you want a neat class to handle it with copy this and add whereever.
    Code:
    public class Sound {
        public Sound(int id){ 
            this(id,0,10);
        }
        public Sound(int id, int delay, int vol) {
            this.id = id;
            this.delay = delay;
            this.vol = vol;
        }
        public static Sound create(Player plr,int id) {
            return create(plr,id,0,10);
        }
        public static Sound create(Player plr,int id, int delay, int vol) {
            this.plr = plr;
            return new Sound(id,delay,vol);
        }
        public Sound send() {
            if (plr != null) {
                plr.getPacketSender().sendSound(id,delay,vol);
            }
            return this;
        }
    }
    Some sounds can be found here https://www.rune-server.ee/runescape...sound-ids.html
    A sound system can be found here https://www.rune-server.ee/runescape...nds-music.html
    Have a nice day!
    Иди в пизду!
    Bonne journée!
    Einen schönen Tag noch!
    Hezký den!
    祝你今天愉快!
    Reply With Quote  
     

  2. #2  
    Registered Member
    hc747's Avatar
    Join Date
    Dec 2013
    Age
    26
    Posts
    1,474
    Thanks given
    3,312
    Thanks received
    691
    Rep Power
    1098
    Quote Originally Posted by S C A P E View Post
    I was doing some stuff with my Elvarg source (started a new one, old one was messed up bad). I wanted game sounds and they didnt work so here is the fixed packet. This will work for any 317, make ajustments where needed.

    Place this in PacketSender (or wherever you send your packets from)
    Code:
    public PacketSender sendSound(int id, int delay, int volume) {
            PacketBuilder out = new PacketBuilder(174);
            out.putShort(id);
            out.putShort(delay);
            out.putShort(volume);
            player.getSession().write(out);
            return this;        
        }
    If you want a neat class to handle it with copy this and add whereever.
    Code:
    public class Sound {
        public Sound(int id){ 
            this(id,0,10);
        }
        public Sound(int id, int delay, int vol) {
            this.id = id;
            this.delay = delay;
            this.vol = vol;
        }
        public static Sound create(Player plr,int id) {
            return create(plr,id,0,10);
        }
        public static Sound create(Player plr,int id, int delay, int vol) {
            this.plr = plr;
            return new Sound(id,delay,vol);
        }
        public Sound send() {
            if (plr != null) {
                plr.getPacketSender().sendSound(id,delay,vol);
            }
        }
    }
    Some sounds can be found here https://www.rune-server.ee/runescape...sound-ids.html
    A sound system can be found here https://www.rune-server.ee/runescape...nds-music.html
    The code provided won't compile; you're missing all the declared variables & a return in the send method, and referencing this (the object) in a static method.
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    Quote Originally Posted by S C A P E View Post
    I was doing some stuff with my Elvarg source (started a new one, old one was messed up bad). I wanted game sounds and they didnt work so here is the fixed packet. This will work for any 317, make ajustments where needed.

    Place this in PacketSender (or wherever you send your packets from)
    Code:
    public PacketSender sendSound(int id, int delay, int volume) {
    		PacketBuilder out = new PacketBuilder(174);
    		out.putShort(id);
    		out.putShort(delay);
    		out.putShort(volume);
    		player.getSession().write(out);
    		return this;		
    	}
    If you want a neat class to handle it with copy this and add whereever.
    Code:
    public class Sound {
        public Sound(int id){ 
            this(id,0,10);
        }
        public Sound(int id, int delay, int vol) {
            this.id = id;
            this.delay = delay;
            this.vol = vol;
        }
        public static Sound create(Player plr,int id) {
            return create(plr,id,0,10);
        }
        public static Sound create(Player plr,int id, int delay, int vol) {
            this.plr = plr;
            return new Sound(id,delay,vol);
        }
        public Sound send() {
            if (plr != null) {
                plr.getPacketSender().sendSound(id,delay,vol);
            }
        }
    }
    Some sounds can be found here https://www.rune-server.ee/runescape...sound-ids.html
    A sound system can be found here https://www.rune-server.ee/runescape...nds-music.html
    As Harrison already pointed out, it won't compile.
    All the variables you're trying to define here, starting with 'this.' do not exist. They're nowhere to be found inside the Sound class. Also, the create method is currently problematic due to the Player field being static.

    You should keep it simple, I'll give you an example:

    Code:
    public final class Sound {
    
    private final int id, delay, vol;
    
        public Sound(int id){ 
            this(id, 0, 10);
        }
    
        public Sound(int id, int delay){ 
            this(id, delay, 10);
        }
    
        public Sound(int id, int delay, int vol) {
            this.id = id;
            this.delay = delay;
            this.vol = vol;
        }
    
    public int getId() {
    return id;
    }
    
    public int getDelay() {
    return delay;
    }
    
    public int getVolume() {
    return vol;
    }
    }
    & in packet sender...
    Code:
    public PacketSender sendSound(Sound sound) {
    		PacketBuilder out = new PacketBuilder(174);
    		out.putShort(sound.getId());
    		out.putShort(sound.getDelay());
    		out.putShort(sound.getVolume());
    		player.getSession().write(out);
    		return this;		
    	}

    To send a sound, you'd simply use the following line: player.getPacketSender().sendSound(new Sound(id, delay, vol));
    Attached image
    Reply With Quote  
     

  5. Thankful users:


  6. #4  
    Registered Member Farage's Avatar
    Join Date
    Jan 2017
    Posts
    252
    Thanks given
    24
    Thanks received
    22
    Rep Power
    0
    Ah thanks. Quickly made it in the text box here. Thanks these issues have been resolved
    Have a nice day!
    Иди в пизду!
    Bonne journée!
    Einen schönen Tag noch!
    Hezký den!
    祝你今天愉快!
    Reply With Quote  
     

  7. #5  
    Banned

    Join Date
    Mar 2011
    Posts
    657
    Thanks given
    105
    Thanks received
    75
    Rep Power
    0
    Code:
    public PacketSender sendSound(Player player,int id, int delay, int volume) {
    		PacketBuilder out = new PacketBuilder(174);
    		out.putShort(id);
    		out.putShort(delay);
    		out.putShort(volume);
    		player.getSession().write(out);
    		return this;		
    	}
    Why do we need to call the player object?

    Don't you have to call player before entering the packet handler?

    i.e - player.getPacketSender().sendSound(delay, volume);
    Reply With Quote  
     

  8. #6  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    Quote Originally Posted by Eggspurt View Post
    Code:
    public PacketSender sendSound(Player player,int id, int delay, int volume) {
    		PacketBuilder out = new PacketBuilder(174);
    		out.putShort(id);
    		out.putShort(delay);
    		out.putShort(volume);
    		player.getSession().write(out);
    		return this;		
    	}
    Why do we need to call the player object?

    Don't you have to call player before entering the packet handler?

    i.e - player.getPacketSender().sendSound(delay, volume);
    Ignore what he has there; if you want for it to work just use what I provided.
    Attached image
    Reply With Quote  
     

  9. #7  
    Extreme Donator


    Join Date
    Oct 2010
    Posts
    2,853
    Thanks given
    1,213
    Thanks received
    1,622
    Rep Power
    5000
    Code:
    public PacketSender sendSound(int id, int delay, int volume) {
    		PacketBuilder out = new PacketBuilder(174);
    		out.putShort(id);
    		out.putShort(delay);
    		out.putShort(volume);
    		player.getSession().write(out);
    		return this;		
    	}
    You don't need the player param, the PacketSender already holds the player.
    Also not worth making a class to hold data which you can simply pass to the method lol.
    Thanks though, nice contribution. Didn't know that the packet was broken.
    Reply With Quote  
     

  10. #8  
    Registered Member Farage's Avatar
    Join Date
    Jan 2017
    Posts
    252
    Thanks given
    24
    Thanks received
    22
    Rep Power
    0
    Quote Originally Posted by Professor Oak View Post
    Code:
    public PacketSender sendSound(int id, int delay, int volume) {
    		PacketBuilder out = new PacketBuilder(174);
    		out.putShort(id);
    		out.putShort(delay);
    		out.putShort(volume);
    		player.getSession().write(out);
    		return this;		
    	}
    You don't need the player param, the PacketSender already holds the player.
    Also not worth making a class to hold data which you can simply pass to the method lol.
    Thanks though, nice contribution. Didn't know that the packet was broken.
    Fix has been applied thanks. Had the wrong op code and help the shorts in wrong order.
    Have a nice day!
    Иди в пизду!
    Bonne journée!
    Einen schönen Tag noch!
    Hezký den!
    祝你今天愉快!
    Reply With Quote  
     

  11. #9  
    Registered Member
    Tamatea's Avatar
    Join Date
    Aug 2010
    Posts
    1,317
    Thanks given
    401
    Thanks received
    357
    Rep Power
    2457
    Take a look at my old sound system release if you're adding sounds, it may be helpful
    Spoiler for sig too large:


    Attached image
    Attached image
    Reply With Quote  
     

  12. #10  
    Banned

    Join Date
    Oct 2013
    Posts
    570
    Thanks given
    3
    Thanks received
    60
    Rep Power
    0
    Nice release, thanks for this.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Sending Sound packets to the client
    By Garrett in forum Snippets
    Replies: 3
    Last Post: 05-04-2013, 02:41 PM
  2. [317] Sound Scape [NEW]
    By Venum112 in forum Advertise
    Replies: 19
    Last Post: 04-24-2010, 01:25 AM
  3. Hosting any 317 server FREE!
    By sourcer in forum Hosting
    Replies: 5
    Last Post: 08-10-2009, 07:00 PM
  4. Replies: 2
    Last Post: 08-07-2009, 07:48 PM
  5. Full 317 Sound list
    By Diesel in forum Requests
    Replies: 11
    Last Post: 03-28-2009, 03:12 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •