Иконка ресурса

FREE CheckSteamHourse : 1.0.0 1.0.0

Нет прав для скачивания
C#:
using System;
using Oxide.Core;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace Oxide.Plugins
{
    [Info("CheckSteamHourse", "TopPlugin.ru", "1.0.0")]
	
	class CheckSteamHourse : RustPlugin
    {
        void OnPlayerConnected(BasePlayer player)
        {
			webrequest.EnqueueGet($"http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=CF09B8FC6C9006E7C75679FFA95D4BE7&steamids={player.UserIDString}", (code, reply) =>
			{
				var respond = JObject.Parse(reply);
				long unixtime = Convert.ToInt64(respond["response"]["players"][0]["timecreated"].ToString());
				double hourssinceregistered = (DateTime.Now - ToDateTime(unixtime)).TotalHours;
				if (hourssinceregistered < 24) player.Kick($"Для игры на сервере Вашему аккаунту должно быть не менее 24 ч.");
			}, this);
        }
		
		private DateTime ToDateTime(long UnixTime)
		{
			DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0);
			return origin.AddSeconds(UnixTime);
		}
	}
}

Автор
15FPS
Скачиваний
0
Просмотры
1
Первый выпуск
Обновление
Оценка
0.00 звёзд 0 оценок
Сверху