Exemple #1
0
        public void OnEntityCreating(int handle)
        {
            if (players == null)
            {
                return;
            }

            int           sender_id = API.NetworkGetEntityOwner(handle);
            GeminisPlayer sender    = players.GetPlayerFromId(sender_id.ToString());

            if (sender != null)
            {
                Entity entity          = Entity.FromHandle(handle);
                int    entity_type     = entity.Type;
                string entity_type_str = this.TypeToName(entity_type);

                if (entity_type_str != null)
                {
                    if (config.entities_ratelimit.TryGetValue(entity_type_str, out _))
                    {
                        Dictionary <string, EntityRatelimit> playerRatelimit = sender.GetData("entities_ratelimit");
                        EntityRatelimit entityRatelimit = playerRatelimit[entity_type_str];

                        if (entityRatelimit.AddAndCheck())
                        {
                            sender.Ban(utils.Format(locale.entity_ratelimit, entityRatelimit.GetCount().ToString(), entity_type_str, entityRatelimit.time.ToString()));
                        }
                    }
                }
            }
        }
Exemple #2
0
 public async void OnClientUnknownResource([FromSource] Player source, string resourceName)
 {
     if (!IsStarted(resourceName) && !IsRecentlyRestarted(resourceName))
     {
         GeminisPlayer geminisPlayer = players.GetPlayerFromSource(source);
         geminisPlayer.Ban(utils.Format(locale.unknown_resource, resourceName));
     }
 }
Exemple #3
0
        public async void OnClientResourceStop([FromSource] Player source, string resourceName)
        {
            if (IsStarted(resourceName) && !IsRecentlyRestarted(resourceName))
            {
                GeminisPlayer geminisPlayer = players.GetPlayerFromSource(source);

                geminisPlayer.Ban(utils.Format(locale.stop_not_allowed, resourceName));
            }
        }
Exemple #4
0
 public async void OnClientResourcesCheck([FromSource] Player source, List <dynamic> resources)
 {
     for (int i = 0; i < resources.Count; i++)
     {
         if (!IsStarted(resources[i]))
         {
             GeminisPlayer geminisPlayer = players.GetPlayerFromSource(source);
             geminisPlayer.Ban(utils.Format(locale.unknown_resource, resources[i]));
             break;
         }
     }
 }
Exemple #5
0
        public async void OnClientModifiedResource([FromSource] Player source, string resourceName)
        {
            GeminisPlayer geminisPlayer = players.GetPlayerFromSource(source);

            geminisPlayer.Ban(utils.Format(locale.modified_resource, resourceName));
        }