Jump to content
  • 0

[HELP]ExShowScreenMessage to all (HOW???)


xXObanXx

Question

Recommended Posts

  • 0

ExShowScreenMessage enter = new ExShowScreenMessage("Your message here", 5000);

 

5000 means 5 seconds u can change this value as u wish

 

that is only for 1 person... i want to show it to ALL in game

Link to comment
Share on other sites

  • 0

for(L2PcInstance players : L2World.getInstance().getAllPlayers().values())
          {
                ExShowScreenMessage enter = new ExShowScreenMessage("Your message here", 5000);
            }

 

try this , and post results

Link to comment
Share on other sites

  • 0

for(L2PcInstance players : L2World.getInstance().getAllPlayers().values())
          {
                ExShowScreenMessage enter = new ExShowScreenMessage("Your message here", 5000);
            }

 

 

try this , and post results

 

actually that's bad , first of all you forgot to add the sendPacket method .

and this way creates the packet for all online characters , thing that it's not needed.

 

So the best way:

 

 

ExShowScreenMessage enter = new ExShowScreenMessage("Your message here", 5000);
for(L2PcInstance j : L2World.getInstance().getAllPlayers().values()){
if(j == null)
continue;
j.sendPacket(enter);
}

Link to comment
Share on other sites

  • 0

actually that's bad , first of all you forgot to add the sendPacket method .

and this way creates the packet for all online characters , thing that it's not needed.

 

So the best way:

 

 

ExShowScreenMessage enter = new ExShowScreenMessage("Your message here", 5000);
for(L2PcInstance j : L2World.getInstance().getAllPlayers().values()){
if(j == null)
continue;
j.sendPacket(enter);
}

 

thank's for help, i will test it now if it works!

Link to comment
Share on other sites

  • 0

Collection<L2PcInstance> plrs = L2World.getInstance().getAllPlayers().values();
               CreatureSay cs = new CreatureSay(1, Say2.ANNOUNCEMENT, "Server:", "lalalala");
              
               for (L2PcInstance p : plrs)
               {
                       p.sendPacket(cs);
               }

 

try it

Link to comment
Share on other sites

  • 0

ExShowScreenMessage doesn't work on interlude you should rework it thats why it doesn't work

And also Iracundus its doesn't need to check it is null or not if there is a packet it will send it.

Link to comment
Share on other sites

  • 0

At least on mine it work normally

Sorry i thought it was for interlude.

A null check is to prevent NPE. In 95% of any cases, a null check isn't needed, mostly if the program is correctly working and all synchronizations are correct.

 

I don't think Collection itself forbid null objects.

The fact is, when you pick up players in a collection, one of those players could suddenly drop during the process. If you make operations on that player, then it would be wrong and probably will send NPE.

Link to comment
Share on other sites

  • 0

what's the problem?

for me it works.

 

on eclipse don't get any error and on build too... but in the game don't show me the screenmessage

 

check please if this code is ok:

			 ExShowScreenMessage vote = (new ExShowScreenMessage("Need " + votesneed + " votes More to Reward all Players.", 10000));
		 for(L2PcInstance player : L2World.getInstance().getAllPlayers().values())
		 {
			 if(player == null)
			  continue;
		 sendPacket(vote);
		 }

i have any problem on this?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


  • Posts

    • rename the l2.bin into l2.exe
    • L2LIVE.PRO- Dynamic Mid-rates Essence Seven Signs GRAND OPENING - July 5, 20:00 GMT+3 (EEST) TEST SERVER IS OPEN - COME AND CHECK IT OUT TODAY! Join our community and be part of it at: https://www.l2live.pro https://discord.gg/k3NMgR4Dmu   Server description * EXP/SP: Dynamic (x1- x100 based on your level, *before* Sayha and EXP buffs * Adena: x50 / Item Drop: x10 / Fishing EXP increased / Attribute EXP increased * Simplified gameplay to stay in the loop while not spending hours and hours farming * Starter Pack containing very useful items for beginners * MP replenishing potions with auto-consumption * No overpowered donations L2LIVE shop * All spellbook coupons, pet spellbook coupons and master books are sold via Game Assistant * Additionally you can buy SP pouches, enchanted talismans, pet training guides and various other consumables for Adena and L-Coin * More items such as cloaks, more talismans, agathions, belts, pendants, enchantment scrolls of various grades, evolution stones, etc will be added! Shop server as a shortcut, and all retail-like ways of earning items are still here! L-Coins * Drops with small change and in random amounts from Lv60+ monsters  * All raidbosses drop random amount of L-Coin Pouches generating up to 420 Lcoin per unit. **Grand Olympiad and Events** * Grand Olympiad is held week day * Format is 1v1, unlimited weekly fights  * Heroes are declared weekly at Sunday * There are three automated events - TvT, CTF and Deathmatch, running at evenings * Orc Fortress, Battle with Balok, Keber Hunter, Archievements Box, Daily Gift Calendar provisional events are active too Custom user commands * .offlineplay command, your character will keep playing till death or server restart * .offlineshop command, keeps your shop sitting until all items are purchased * .apon / .apoff - enable/disable HP/MP autoconsume And lots of other small improvements are waiting for you!   Join our community and be part of it at: https://www.l2live.pro https://discord.gg/k3NMgR4Dmu
  • Topics

×
×
  • Create New...