PatPeter

Escape Timer Code

Oct 1st, 2019
146
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. this.EscapeTimer = new System.Timers.Timer
  2. {
  3. Interval = 5000,
  4. Enabled = false,
  5. AutoReset = true
  6. };
  7.  
  8. this.EscapeTimer.Elapsed += delegate
  9. {
  10. // Search for user to convert and only convert 1 at a time
  11. foreach (Player p in this.Server.GetPlayers())
  12. {
  13. if (p.TeamRole.Team == Team.SCP)
  14. {
  15. continue;
  16. }
  17.  
  18. if (this.isInNTFEscape(p.GetPosition()))
  19. {
  20.  
  21. if (p.TeamRole.Role == Role.NTF_COMMANDER)
  22. {
  23. continue;
  24. }
  25.  
  26. switch (p.TeamRole.Role)
  27. {
  28. case Role.SCIENTIST:
  29. p.ChangeRole(Role.NTF_SCIENTIST);
  30. break;
  31.  
  32. case Role.FACILITY_GUARD:
  33. p.ChangeRole(Role.NTF_CADET);
  34. break;
  35.  
  36. case Role.NTF_CADET:
  37. p.ChangeRole(Role.NTF_LIEUTENANT);
  38. break;
  39.  
  40. case Role.NTF_LIEUTENANT:
  41. p.ChangeRole(Role.NTF_COMMANDER);
  42. break;
  43.  
  44. default:
  45. break;
  46. }
  47. }
  48. }
  49. };
RAW Paste Data