Hey Guys!
need help with iPrintLn ..
I want is the message every minute or second...
[Sorry for My english
]
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; }
}
}
Timer works fine and you don't have to work with threads yourself....
Se precisar de ajuda cara me add...
English:
If you need help add me...
Thanks Barata...
(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);
}
}
}
(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
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
This works for me perfectly. I checked out. I cited an example. To use it or not, decide for yourself.
(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--;
}
}
}