Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Request] iPrintLn Automatic time
#1
Brick 
Hey Guys!Smile

need help with iPrintLn ..
I want is the message every minute or second...
[Sorry for My english Undecided]


Code:
using Addon;
using System.Threading;

namespace iPrintLn
{
    public class iPrintLn : CPlugin
    {
    
        public override void OnServerLoad()
        {
            ServerPrint("iPrintLntest");
        }

        public override void OnPlayerConnect(ServerClient Client)
        {
            iPrintLn("message", null);

        }

        private void iPrintLnBold(string p, bool p_2)
        {

        }

        private bool player { get; set; }

      
    }

}
Reply

#2
http://msdn.microsoft.com/en-us/library/....110).aspx
Reply

#3
(12-17-2012, 15:31)JariZ Wrote: http://msdn.microsoft.com/en-us/library/....110).aspx

Aaaaaaand again Threads....
Use Stopwatches:
http://msdn.microsoft.com/en-us/library/...watch.aspx
[Image: compiling.png][Image: aLKA8og_460sa.gif]
Reply

#4
Timer works fine and you don't have to work with threads yourself....
Reply

#5
Se precisar de ajuda cara me add...

English:

If you need help add me...

Thanks Barata...
Don't worry if things aren't the way you planned, in the end everything will solve itself...
Reply

#6
(12-18-2012, 06:24)barata Wrote: Se precisar de ajuda cara me add...

English:

If you need help add me...

Thanks Barata...

looks good this way?
forgiveness is that I am new to visual basic plugins ...


Code:
using Addon;
using System.Threading;
using System.Runtime.InteropServices;
using System.Threading;
using System;
using System.Diagnostics;

namespace iPrintLn
{
    public class iPrintLn : CPlugin
    {


        static void Main(string[] args)
        {
            Stopwatch stopWatch = new Stopwatch();
            stopWatch.Start();
            Thread.Sleep(10000);
            stopWatch.Stop();
            // Get the elapsed time as a TimeSpan value.
            TimeSpan ts = stopWatch.Elapsed;

            // Format and display the TimeSpan value.
            string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
                ts.Hours, ts.Minutes, ts.Seconds,
                ts.Milliseconds / 10);
            Console.WriteLine("RunTime " + elapsedTime);
        
        }

        public override void OnServerFrame()
        {
          iPrintLn("message", null);
        
        }  

     }

}
Reply

#7
Reply

#8
(12-19-2012, 07:48)XxBRxX Wrote:
(12-18-2012, 06:24)barata Wrote: Se precisar de ajuda cara me add...

English:

If you need help add me...

Thanks Barata...

looks good this way?
forgiveness is that I am new to visual basic plugins ...


Code:
using Addon;
using System.Threading;
using System.Runtime.InteropServices;
using System.Threading;
using System;
using System.Diagnostics;

namespace iPrintLn
{
    public class iPrintLn : CPlugin
    {


        static void Main(string[] args)
        {
            Stopwatch stopWatch = new Stopwatch();
            stopWatch.Start();
            Thread.Sleep(10000);
            stopWatch.Stop();
            // Get the elapsed time as a TimeSpan value.
            TimeSpan ts = stopWatch.Elapsed;

            // Format and display the TimeSpan value.
            string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
                ts.Hours, ts.Minutes, ts.Seconds,
                ts.Milliseconds / 10);
            Console.WriteLine("RunTime " + elapsedTime);
        
        }

        public override void OnServerFrame()
        {
          iPrintLn("message", null);
        
        }  

     }

}

In Librarys there are no Main.
And this is C# not VB Wink

Look into my sourcecode from EpicZombie in the "main"(dont know how i named it) class in OnServerFrame you can see the usage of StopWatch.


@Zoomby:
Do you even know what your code does? You know that OnServerFrame isn't called in constant times. -> It depends on your CPU how hast it can call OnServerFrame
[Image: compiling.png][Image: aLKA8og_460sa.gif]
Reply

#9
This works for me perfectly. I checked out. I cited an example. To use it or not, decide for yourself.
Reply

#10
(12-19-2012, 18:45)[Z00MBY] Alex Wrote: This works for me perfectly. I checked out. I cited an example. To use it or not, decide for yourself.

hey guys.
I pull some lines that gave me error.
tego version of teknogods v206..
I'll see if it works that way.

Code:
using System;
using System.Collections.Generic;
using Addon;
using System.Collections;

namespace mes
{
    public class mes : CPlugin
    {
        int Interval;

        public override void OnMapChange()
        {
            Interval = 0;
        }

        public override void OnFastRestart()
        {
            Interval = 0;
        }

        public override void OnServerFrame()
        {
            List<ServerClient> clients;
            try
            {
                clients = GetClients();
                if (clients != null)
                {
                    foreach (ServerClient client in GetClients())
                    {

                        {
                            if (Interval <= 0)
                            {
                                iPrintLn("message", null);
                                Interval = 60 * 60; // period 60 sec
                            }

                        }
                    }
                }
            }
            catch (Exception e)
            {
                ServerPrint("Error in mes plugin: \n" +
                             e.Message + "\n" +
                             e.StackTrace + "\n" +
                             e.Source + "\n" +
                             e.InnerException + "\n" +
                             e.HelpLink);
            }

            if (Interval > 0)
                Interval--;

        }
    }
}
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Request] Request for Assistance with Modding COD: BO using Mod Tools one1lion 9 6,673 09-17-2013, 21:04
Last Post: one1lion
  [Request] Airdrop Heaven mod The_Reaper_1 0 2,454 09-10-2013, 14:13
Last Post: The_Reaper_1
  [Request] Request for !afk and !balance plugins. UlTiiMaTuM 3 3,574 09-10-2013, 02:13
Last Post: UlTiiMaTuM
Information [Request] Need Time Plugin and Server Msg Plugin sylvester123 14 9,370 07-26-2013, 08:07
Last Post: sylvester123
  4D1 Extend Feeding Time Tacticalicious 1 2,589 07-02-2013, 20:59
Last Post: surtek
  [REQUEST] Antinoob mod sleepunknot 3 3,128 05-15-2013, 20:10
Last Post: sleepunknot
Tongue What are you doing in free time? Nekochan 16 8,867 05-05-2013, 08:25
Last Post: Pozzuh
  Moab and server request CHRISLUVMSR 6 4,694 04-17-2013, 18:28
Last Post: X-Track
  [Request] Teknogods Expert's Classes 1.5 request The6thMessenger 0 2,434 04-13-2013, 08:22
Last Post: The6thMessenger
  [Request] Automatic save Rendflex 10 6,289 04-06-2013, 21:51
Last Post: barata

Forum Jump:


Users browsing this thread:
2 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.