07-26-2013, 15:30
(This post was last modified: 07-26-2013, 15:35 by Bandarigoda123.)
I don't know if anyone has made this, anyway.
visitplug.zip (Size: 2.08 KB / Downloads: 168)
visitplug.zip (Size: 2.08 KB / Downloads: 168)
CSHARP Code
- using System.Text;
- using Addon;
- using System.IO;
-
- namespace visitplug
- {
- public class visitplug : CPlugin
- {
- public override void OnServerLoad()
- {
- try
- {
- Directory.CreateDirectory(@"Visits");
- ServerPrint("Visit Plugin V1.0 Loaded -- SShattered");
- }
- catch (Exception ex)
- {
- ServerPrint("Visit Plugin V1.0 Loaded -- SShattered");
- }
- }
-
- public override void OnPlayerConnect(ServerClient Client)
- {
- if (File.Exists(@"Visits\" + Client.XUID + ".txt"))
- {
- string counts = File.ReadAllText(@"Visits\" + Client.XUID + ".txt");
- double count = Convert.ToDouble(counts);
- double newcc = count + 1;
- string newcount = Convert.ToString(newcc);
- File.WriteAllText(@"Visits\" + Client.XUID + ".txt", newcount);
- ServerSay("Welcome Player ^2" + Client.Name + " ^7to the Server", true);
- ServerSay("He has played ^1" + counts + " ^7times", true);
- }
- else
- {
- File.WriteAllText(@"Visits\" + Client.XUID + ".txt", "1");
- ServerSay("Welcome Player ^2" + Client.Name + " ^7to the Server", true);
- }
- }
- }
- }