Jump to content
  • 0

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


Question

Posted

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!

Recommended Posts

  • 0
Posted

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

  • 0
Posted

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

 

try this , and post results

  • 0
Posted

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);
}

  • 0
Posted

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!

  • 0
Posted

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

  • 0
Posted

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.

  • 0
Posted

And the null check is needed, so far.

At least on mine it work normally

Sorry i thought it was for interlude.

  • 0
Posted

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.

  • 0
Posted

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?

Guest
This topic is now closed to further replies.


  • Posts

    • Hello, I add this code here https://maxcheaters.com/topic/248730-agathions-acis-401-does-not-interfere-with-summons-or-pets/.     but i have problem with agathion movement, agathion does not move when the player moves. The player must stop moving for Agathion to come close him.   i think the problem is here at < _followTask = ThreadPool.scheduleAtFixedRate(new Follow(this), 1000, 1000); >>       public void followToOwner()     {                  if (_followTask == null)             _followTask = ThreadPool.scheduleAtFixedRate(new Follow(this), 1000, 1000);                                  int rnd = Rnd.get(-30, +30);         SpawnLocation loc = _owner.getPosition();                          if (!checkIfInRange(1000, this, _owner))             teleport(_owner, 30);                  if (_owner.isMoving())             getAI().tryToFollow(_owner, false);         else         {             if (!checkIfInRange(75, this, _owner))                 getAI().tryToMoveTo(new Location(loc.getX()+rnd, loc.getY()+rnd, loc.getZ()), null);             else if (checkIfInRange(30, this, _owner))                 getAI().tryToIdle();                              if (Config.AGATHION_HEAL_OWNER && !getCast().isCastingNow())             {                 if (_owner.isInOlympiadMode() || _owner.isInDuel() || _owner.getPvpFlag() != 0 || _owner.isInsideZone(ZoneId.PVP) || _owner.getKarma() != 0)                     return;                                  if ((_owner.getStatus().getHpRatio() < Config.AGATHION_PERCENT_TO_HEAL))                     getAI().tryToCast(_owner, 1011, 18);             }             else if (!Config.AGATHION_ONLY_FOLLOW && Config.AGATHION_ALLOW_SOCIAL && !isMoving() && !getCast().isCastingNow())                 broadcastPacket(new SocialAction(this, 1));         }  
    • Price reduction for Google accounts from 6-12 months after registration - only 0.3157$ each. Top up with Gmail accounts with activated 2FA - 0.3507$ each!
    • We are certainly not an ambulance, but we will definitely cure you of blacklists and empty pockets. Live freely with SX! Each of you will receive a trial version of SX to familiarize yourself with the product, all you have to do is post in this thread
    • Hello everyone! L2 Imagination High Five - New Seasson is here!       OPEN BETA from 17.03.2025 LIVE START 21.03.2025 GMT+1      Rates: XP/SP 25x, Spoil 15x, Drop 10x, Adena 10x   Server Features: Free Auto-Farm, Castle Instance, Daily Reward Calendar, Adena Boxes VIP Gold Color Chat, Unique Olympiad Extra Points Engine, GvG Event Solo Instance, PvP Solo Rift, Automatic GvG Event, Improved Orfen and Core Areas Lair of Antharas and Dragon Valley alternating PvP and Normal  every hour 6:00PM-0:00AM      Website: https://www.l2imagination.com  Discord: https://discord.com/invite/frCaDM4Bhg
  • Topics

×
×
  • Create New...