Jump to content
  • 0

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


xXObanXx
 Share

Question

Hello MxC! so i want to tell me a code that all players will see the screen message that i will put!

everyone knows how to do that?!!!

 

i have freya server last revision!

Link to comment
Share on other sites

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



  • Posts

    • what you give me if i can make it work only editing server side on acis ? you use requestrestart to relog a player without player making any client action
    • does not show the dye bar   https://prnt.sc/4988fu       Hello, I am adding a new class, everything works fine, but the dye bar is not added where it should be added so that the new class shows the bar.
    • anyone know how to get the acm/admin area working properly? "it keep saying 'account already exist', and admin area always saying errror, already tried both conn type mysqli/pdo
    • Фашист ты куда пропал, от 2 сентября форум не посещаешь когда на фронт? Мы с апреля бомбим ваши города, ваши приграничные зоны Белгородской области частично стерты с лица земли уже сегодня, остальное добьем в течении пары месяцев. Ваши отряды быстрого реагирования из погранслужбы фсб рф попадают в засады на территории рф, как недавно было в Курской области. В Брянской области количество 300-х пограничников идет на десятки, а ж/д мосты взрываются с периодичностью раз в пару недель, я уже молчу о точечных ударах по складам в Белгородской и Брянской областях, взрывы в Таганроге и нападение на пункт дислокации вс рф в Клинцах.  Вас никто уже давно не боится. Вы - черти, которых американцы, пусть и нашей кровью, намерены стереть с лица земли как государство. Об этом открыто и публично говорит американский генералитет. Охотники не вы, охотятся на вас. Это пора принять и осознать, несмотря на то, сколько еще украинских героев погибнет и сколько гражданских вы еще убьете крылатыми ракетами.
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock