Page 1 of 1

question about message broadcast to all players

Posted: Fri Jul 03, 2009 6:02 pm
by eriko
If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision Number:3259
L2JDP Revision Number:

I'm sorry for asking about this, i know about other post, but i don't really understand how it works

for example i found this example:

Code: Select all

Broadcast.toAllOnlinePlayers(SystemMessage.sendString("Message"));
OR

Examples (not completed):

Code: Select all

activeChar.sendPacket(new CreatureSay (...));activeChar.sendPacket(new ExShowScreenMessage (...));
if someone can show me a simple example pls of how to use this on object from L2PcInstance !

Re: question about message broadcast to all players

Posted: Fri Jul 03, 2009 8:41 pm
by dip_bow
Not if I understand your question very well, but try to answer

For example:

Code: Select all

if (targetPlayer.isCursedWeaponEquipped())                 // Target is a CursedWeapon Holder        {                  increasePvpKills();                  Broadcast.toAllOnlinePlayers(SystemMessage.sendString("The owner of the demonic sword has died"));        }               

This code send a message to all players, This message is seen where you see
damage.

Re: question about message broadcast to all players

Posted: Sun Jul 05, 2009 2:54 am
by eriko
I try to use:

Code: Select all

Broadcast.toAllOnlinePlayers(new ExShowScreenMessage("Message", 500));
but the message display for a few seconds

the full code

Code: Select all

    public void captureSone(L2PcInstance player, L2NpcInstance  npc, L2Skill skill){        if(player.getFaction() == 0 && player.getTargetId() == npc.getObjectId()){            if(skill.getId() == 246){                if(player.getFaction() != npc.getFaction()){                    npc.updateFaction(player.getFaction());                    Broadcast.announceToOnlinePlayers(player.getName()+" HAS CAPTURED "+npc.getName()+" !!");                    Broadcast.toAllOnlinePlayers(new ExShowScreenMessage(player.getName()+" HAS CAPTURED "+npc.getName()+" !!", 500));                    this.addReward(player);                    System.gc();                }            }else{                double hpc = player.getCurrentHp();                double hpm = player.getMaxHp();                double php = (hpc/hpm)*100;                if(php > 5){                    double hp = (hpc*0.17);                                     player.reduceCurrentHp(hp,player,false, false, null);                    player.broadcastUserInfo();                }else{                    player.doDie(player);                    player.broadcastUserInfo();                }            }        }    }

Re: question about message broadcast to all players

Posted: Mon Jul 06, 2009 6:42 pm
by dip_bow
eriko wrote:I try to use:

Code: Select all

Broadcast.toAllOnlinePlayers(new ExShowScreenMessage("Message", 500));
but the message display for a few seconds
If you want it longer, you must increase the number 500, 500 means the time which will be