Jump to content
  • 0

Question about pvp reward aka sounds


Question

Posted

Hi guys i need some java help so here we go:

reward players for a pvp kill in a related zone here is the code:

// pvp reward
	if (isInsideZone(ZONE_PVP))
	{
		addItem("Loot", 8732, 1, this, true);
		sendMessage("You won 1 lifestone for a pvp kill!");
	}

How can i add 1 more zone?

 

Also About pvp counterstike sounds

code:

+             case 1:
+                PlaySound _snd1 = new PlaySound(1, "firstblood", 0, 0, 0, 0, 0);
+                sendPacket(_snd1);
+             break;
+             
+             case 2:
+                PlaySound _snd2 = new PlaySound(1, "doublekill", 0, 0, 0, 0, 0);
+                sendPacket(_snd2);
+             break;
+             
+             case 3:
+                PlaySound _snd3 = new PlaySound(1, "triplekill", 0, 0, 0, 0, 0);
+                sendPacket(_snd3);
+             break;
+             
+             case 4:
+                PlaySound _snd4 = new PlaySound(1, "megakill", 0, 0, 0, 0, 0);
+                sendPacket(_snd4);
+             break;
+             
+             case 5:
+                PlaySound _snd5 = new PlaySound(1, "ultrakill", 0, 0, 0, 0, 0);
+                sendPacket(_snd5);
+             break;
+             
+             case 10:
+                PlaySound _snd10 = new PlaySound(1, "monsterkill", 0, 0, 0, 0, 0);
+                sendPacket(_snd10);
+             break;
+             
+             case 15:
+                PlaySound _snd15 = new PlaySound(1, "killingspree", 0, 0, 0, 0, 0);
+                sendPacket(_snd15);
+             break;
+               default:
+                ;
+             }   
+      

how can i make it to play sound to all players in l2 world and not only to the killing spree person?

 

5 answers to this question

Recommended Posts

  • 0
Posted

 

 

// pvp reward
	if (isInsideZone(ZONE_PVP) || isInsideZone(ZONE_PEACE))
	{
		addItem("Loot", 8732, 1, this, true);
		sendMessage("You won 1 lifestone for a pvp kill!");
	}

 

or

 

// pvp reward
	if (!isInsideZone(ZONE_PEACE))
	{
		addItem("Loot", 8732, 1, this, true);
		sendMessage("You won 1 lifestone for a pvp kill!");
	}

 

and

 

+L2PcInstance[] players = L2World.getInstance().getAllPlayers().values(new L2PcInstance[0]);		
+switch(your variable...){
+             case 1:
+                PlaySound _snd1 = new PlaySound(1, "firstblood", 0, 0, 0, 0, 0);
+for(L2PcInstance pl : players){
+                pl.sendPacket(_snd1);}
+             break;
+             
+             case 2:
+                PlaySound _snd2 = new PlaySound(1, "doublekill", 0, 0, 0, 0, 0);
+for(L2PcInstance pl : players){
+                pl.sendPacket(_snd2);}
+             break;
+             
+             case 3:
+                PlaySound _snd3 = new PlaySound(1, "triplekill", 0, 0, 0, 0, 0);
+for(L2PcInstance pl : players){
+                pl.sendPacket(_snd3);}
+             break;
+             
+             case 4:
+                PlaySound _snd4 = new PlaySound(1, "megakill", 0, 0, 0, 0, 0);
+for(L2PcInstance pl : players){
+                pl.sendPacket(_snd4);}
+             break;
+             
+             case 5:
+                PlaySound _snd5 = new PlaySound(1, "ultrakill", 0, 0, 0, 0, 0);
+for(L2PcInstance pl : players){
+                pl.sendPacket(_snd5);}
+             break;
+             
+             case 10:
+                PlaySound _snd10 = new PlaySound(1, "monsterkill", 0, 0, 0, 0, 0);
+for(L2PcInstance pl : players){
+                pl.sendPacket(_snd10);}
+             break;
+             
+             case 15:
+                PlaySound _snd15 = new PlaySound(1, "killingspree", 0, 0, 0, 0, 0);
+for(L2PcInstance pl : players){
+                pl.sendPacket(_snd15);}
+             break;
+               default:
+                ;
+             }   
+      

 

  • 0
Posted

Well i tried to insert sound code into quake system here it is:

{
		case 5:
			if(Config.ENABLE_ANTI_PVP_FARM_MSG){
				CreatureSay cs12 = new CreatureSay(0, 15, "",  getName() + " is on a Killing Spree!"); // 8D
				PlaySound _snd1 = new PlaySound(1, "killingspree", 0, 0, 0, 0, 0);
				sendPacket(_snd1);
				for(L2PcInstance player: L2World.getInstance().getAllPlayers())
				{
					if(player != null)
						if(player.isOnline()!=0)
							if(player.isGM())					
								player.sendPacket(cs12);                  						
				}
				for(L2PcInstance player: L2World.getInstance().getAllPlayers())
								{
									if(player != null)
										if(player.isOnline()!=0)
											player.sendPacket(_snd1);
								}			
			}

 

but only sound works, message doesnt go to all players :/

  • 0
Posted

I dunno if you simply thought about your system, but it will be a terrible mess if everyone can listen sounds of others.

 

About your question itself => Broadcast.java got a lot of useful methods.

 

Finally, cs12 must be broadcasted aswell (not to GMs only...). You only broadcast _snd1 to everyone. And fusion both checks...

  • 0
Posted

I dunno if you simply thought about your system, but it will be a terrible mess if everyone can listen sounds of others.

 

About your question itself => Broadcast.java got a lot of useful methods.

 

Finally, cs12 must be broadcasted aswell (not to GMs only...). You only broadcast _snd1 to everyone. And fusion both checks...

aight thanls for your times guys topic can be locked

 

Guest
This topic is now closed to further replies.


×
×
  • Create New...