508/525 Server/Player Message using a event. 508/525

Go down

508/525 Server/Player Message using a event. 508/525

Post  Nathan on Tue Nov 02, 2010 2:45 pm

508/525 Server/Player Message 508/525.

i see some servers who just stick a message in process well thats a bad idea seeing as it keeps on ticking constanly.

This snippet will show u if a player is online. every 5 mins they will get a server/player message.

Player.java.

Code:
public int ServerMess;
public void ServerMessage(final Player p) {
EventManager.getSingleton().addEvent(
new Event() {
public void execute(EventContainer c) {
if (p == null || !p.online) {
c.stop();
return;
}
ServerMess++;
if (ServerMess == 5) {
p.getActionSender().sendMessage(p, "Message Here");
}
if (ServerMess == 5) {
ServerMess = 0;
}
               }
            }, 60000);
   };

rs2loginprotocol.java

in ur login method add this.

Code:
p.ServerMessage(p);

Nathan
Registered Member
Registered Member

Posts : 3
Join date : 2010-10-30

View user profile

Back to top Go down

Re: 508/525 Server/Player Message using a event. 508/525

Post  Ix Hybrid Xi on Tue Nov 02, 2010 3:28 pm

Good job on this as using proccesses can cause more lagg and this is better soloution therefore gj Smile.

_________________
avatar
Ix Hybrid Xi
Forum Administrator
Forum Administrator

Posts : 43
Join date : 2010-10-06

View user profile

Back to top Go down

Re: 508/525 Server/Player Message using a event. 508/525

Post  startcode on Wed Nov 03, 2010 9:20 am

good job nathan Smile

startcode
Registered Member
Registered Member

Posts : 14
Join date : 2010-10-07

View user profile

Back to top Go down

Re: 508/525 Server/Player Message using a event. 508/525

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum