ItsMods

Full Version: Need Time Plugin and Server Msg Plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(07-23-2013, 18:34)8q4s8 Wrote: [ -> ]Did you update the plugin with the code that I posted?

No, I dont know how to update/edit plugins Confused
Will u plz tell me how? or will u edit for me?
(07-23-2013, 18:44)8q4s8 Wrote: [ -> ]http://www.itsmods.com/forum/showthread.php?tid=5833

I dont have Microsoft Visual plz edit this string Undecided
get the Plugin Maker from: @SailorMoon
that works to create simple plugins, or download Microsoft Visual Studio
(07-23-2013, 16:28)8q4s8 Wrote: [ -> ]
CSHARP Code
  1. using System;
  2. using System.Collections.Generic;
  3. using Addon;
  4. using System.Text;
  5. using System.Timers;
  6.  
  7. namespace ClassLibrary1
  8. {
  9. public class Class1:CPlugin
  10. {
  11. List<string> MessageList = new List<string>();
  12. Timer timer = new Timer();
  13. int interval;
  14. int Messages;
  15. int CurrentMSG;
  16.  
  17. public override void OnServerLoad()
  18. {
  19. Config();
  20. ServerPrint("TimedMessage Plugin by 8Q4S8 loaded!");
  21. }
  22. void handler(object s, ElapsedEventArgs e)
  23. {
  24. if (Messages <= CurrentMSG)
  25. {
  26. CurrentMSG = 0;
  27. }
  28. if (MessageList[CurrentMSG] != "!time")
  29. {
  30. ServerSay(MessageList[CurrentMSG], true);
  31. }
  32. else
  33. {
  34. ServerSay("Time (UTC " + TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now).TotalHours + "): ^2" + DateTime.Now.ToLongTimeString(), true);
  35. }
  36.  
  37. CurrentMSG++;
  38. }
  39. void Config()
  40. {
  41. try
  42. {
  43. interval = int.Parse(GetServerCFG("TimedMSG", "interval", ""));
  44. Messages = int.Parse(GetServerCFG("TimedMSG", "Messages", ""));
  45.  
  46. if (Messages != 0)
  47. {
  48. CurrentMSG = 0;
  49. for (int i = 1; i <= Messages; i++)
  50. {
  51. MessageList.Add(GetServerCFG("TimedMSG", "MSG" + i.ToString(), ""));
  52. }
  53. }
  54. timer.Interval = 1000 * interval;
  55. timer.Elapsed += new ElapsedEventHandler(handler);
  56. timer.Enabled = true;
  57.  
  58.  
  59. }
  60. catch (Exception e)
  61. {
  62. ServerPrint(e.Message);
  63. }
  64. }
  65. }
  66. }


Edit this string to the colors you like and compile it
CSHARP Code
  1. ServerSay("Time (UTC + " + TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now).TotalHours + "): ^2" + DateTime.Now.ToLongTimeString(), true);


then you can use MSG1=!time to show the time.

Thanks it works, Compiled using SailorMoon Plugin Maker 4.
Pages: 1 2