Jump to content
  • 0

How to check the time has passed into switch kill in a row


StarSCreams

Question

hi,

I have this code and try to verify the time has passed when case occurred

Example in l2pcinstance:
 

private int assasins = 0;

switch(assasins) {
  case 2:
    Announcements.getInstance().announceToAll("Player " + pk.getName() + " has killed two times" + pk.getTarget().getName());
    break;
  case 3:
    Announcements.getInstance().announceToAll("Player " + pk.getName() + " has killed three times" + pk.getTarget().getName());
  default:
}

 

i need verify if the next kill (case 3) ocurred  < 10 seconds. if the time passed make a different announcements..

 

i think how see the code with my idea...

private int assasins = 0;
switch(assasins) {
  case 2:
    	Announcements.getInstance().announceToAll("Player " + pk.getName() + " has killed two times" + pk.getTarget().getName());
		ThreadPoolManager.getInstance().schedule(assasins = 3 , 10 * 1000);
    break;
  case 3:
    Announcements.getInstance().announceToAll("Player " + pk.getName() + " has killed" + pk.getTarget().getName());
		ThreadPoolManager.getInstance().schedule(assasins = 4 , 10 * 1000);
    break;
  default:
}

 

sorry my bad english :3

Link to comment
Share on other sites

Recommended Posts

  • 0
2 hours ago, wongerlt said:

show me ur code, how u do. maybe u make mistake.

 

hey, check my player.java with your help.. search //killingspree to see the mods..

 

https://pastebin.com/PZGC0vqk

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now



×
×
  • Create New...