Jump to content

any coder online , i need small update (PAID)


mrdecoder

Recommended Posts

im trying to change turret weapons on umod to use permissions instead of config 
 

private void OnServerInitialized()
        {
            foreach (var item in ItemManager.itemList)
            {
                var proj = item.GetComponent<ItemModEntity>()?.entityPrefab?.Get()?.GetComponent<BaseProjectile>();
                if (proj != null)
                {
                    bool isAllowed;
                    if (!_config.Weapons.TryGetValue(item.shortname, out isAllowed))
                    {
                        _config.Weapons[item.shortname] = false;
                        proj.usableByTurret = false;
                        continue;
                    }

                    proj.usableByTurret = isAllowed;
                }
            }
            
            SaveConfig();

            foreach (var entity in BaseNetworkable.serverEntities)
            {
                if (entity is HeldEntity)
                    OnEntitySpawned(entity as HeldEntity);
            }
        }

my head hurts and cant think good so if someone can help me on this i would be very happy 
 

Link to comment
Share on other sites

all weapons are allowed but all blocked ones will have a permission 

for example rocket launcher 
 

if (!player.IPlayer.HasPermission(AllowRocket))    
                {
                    player.ChatMessage("<size=16><color=#AB2121>You dont have permission to use rocketlauncher</size></color>");
                }



 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
1.1m

Downloads

Total number of downloads.

5.5k

Customers

Total customers served.

78.6k

Files Sold

Total number of files sold.

1.5m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.