Good day all,
I was wondering if there is someone that can help me too look into this plugin I am developing and fix it up if there is any errors or issues that I have overlooked with my limited C# and umod knowledge. What I have put together below is based on some other plugins I looked at and also from looking at the doc's on here:
Any help here would be appreciated. This will be my first very basic plugin. I am maybe thinking of using it to also create other groups and manage them so the name might change once I have it working.
I was wondering if there is someone that can help me too look into this plugin I am developing and fix it up if there is any errors or issues that I have overlooked with my limited C# and umod knowledge. What I have put together below is based on some other plugins I looked at and also from looking at the doc's on here:
using System;
using System.Linq;
using System.Globalization;
using System.Collections.Generic;
using UnityEngine;
using Oxide.Core.Plugins;
using Oxide.Game.Rust.Cui;
namespace Oxide.Plugins
{
[Info("AdminGroupControl", "silent001", "0.0.1")]
[Description("A basic plugin that adds/removes players to admin group based on the auth level specified in the plugin config")]
class AdminGroupControl : RustPlugin
{
private PluginConfig config;
void OnServerInitialized()
{
bool GroupExists = permission.GroupExists(GroupName);
}
void OnPlayerInit(BasePlayer player)
{
if (player.net.connection != null)
if (player.net.connection.authLevel >= PlayerAuthLevel){
if (!permission.UserHasGroup(player.id, GroupName)){
permission.AddUserGroup(player.id, GroupName);
}
}else{
if(!permission.UserHasGroup(player.id, GroupName)){
permission.RemoveUserGroup(player.id, GroupName);
}
}
}
private void Init()
{
config = Config.ReadObject<PluginConfig>();
}
protected override void LoadDefaultConfig()
{
Config.WriteObject(GetDefaultConfig(), true);
}
private PluginConfig GetDefaultConfig()
{
return new PluginConfig
{
GroupName = "admin",
PlayerAuthLevel = "1"
};
}
}
}
Any help here would be appreciated. This will be my first very basic plugin. I am maybe thinking of using it to also create other groups and manage them so the name might change once I have it working.