xXObanXx Posted May 10, 2012 Share Posted May 10, 2012 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 More sharing options...
0 bullseye92 Posted May 10, 2012 Share Posted May 10, 2012 ExShowScreenMessage enter = new ExShowScreenMessage("Your message here", 5000); 5000 means 5 seconds u can change this value as u wish Link to comment Share on other sites More sharing options...
0 xXObanXx Posted May 10, 2012 Author Share Posted May 10, 2012 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 More sharing options...
0 Rizlaaa Posted May 10, 2012 Share Posted May 10, 2012 for(L2PcInstance j : L2World.getInstance().getAllPlayers()) j.sendPacket(x); in x you add the exshowscreenmessage packet Link to comment Share on other sites More sharing options...
0 `NeverMore Posted May 10, 2012 Share Posted May 10, 2012 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 More sharing options...
0 Rizlaaa Posted May 10, 2012 Share Posted May 10, 2012 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 More sharing options...
0 xXObanXx Posted May 10, 2012 Author Share Posted May 10, 2012 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 More sharing options...
0 xXObanXx Posted May 10, 2012 Author Share Posted May 10, 2012 thank's for help, i will test it now if it works! sorry man, but the code don't work! :( Link to comment Share on other sites More sharing options...
0 Rizlaaa Posted May 10, 2012 Share Posted May 10, 2012 sorry man, but the code don't work! :( what's the problem? for me it works. Link to comment Share on other sites More sharing options...
0 Tryskell Posted May 10, 2012 Share Posted May 10, 2012 Broadcast.java Link to comment Share on other sites More sharing options...
0 Vkouk Posted May 10, 2012 Share Posted May 10, 2012 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 More sharing options...
0 Kяaσh Posted May 10, 2012 Share Posted May 10, 2012 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 More sharing options...
0 Tryskell Posted May 10, 2012 Share Posted May 10, 2012 i have freya server last revision! And the null check is needed, so far. Link to comment Share on other sites More sharing options...
0 Kяaσh Posted May 10, 2012 Share Posted May 10, 2012 And the null check is needed, so far. At least on mine it work normally Sorry i thought it was for interlude. Link to comment Share on other sites More sharing options...
0 Tryskell Posted May 11, 2012 Share Posted May 11, 2012 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 More sharing options...
0 xXObanXx Posted May 11, 2012 Author Share Posted May 11, 2012 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 More sharing options...
Question
xXObanXx
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
24 answers to this question
Recommended Posts