Detailed HitInfo explanation?Solved

Hi, i'm a beginner in programming :)

I want to change damage rocket launcher but i can't get hitinfo that player shoots from rocket lanucher or that shoots ammo.rocket.basic. Please help me with an explanation? Thx :)

void OnWeaponFired(BaseProjectile projectile, BasePlayer player, ItemModProjectile mod, ProtoBuf.ProjectileShoot projectiles)
{
    Puts("OnWeaponFired works!");
}

I hope this is what you are looking for

https://umod.org/documentation/games/rust#onrocketlaunchedyou can look here

HitInfo is the attacking person

var initiator = info.InitiatorPlayer;

you can use it this way

        private void OnEntityDeath(BasePlayer player, HitInfo info)
        {
            var initiator = info.InitiatorPlayer;
            if (initiator == null ) return;
            if (player == null ) return; 
            var Killed = player.displayName;
          
			if(!initiator is BasePlayer) return;
			SendReply(initiator , " You Killed : " + Killed);
        }
I would also recommend digging around Rust's DLLs using a .NET decompiler to see how things work yourself. There's a lot of information in there.

I don't know if we understand each other. I try decompile but I haven't been able to program it yet :/

I would like to add a condition if it fires from the rocket launcher - ammo.rocket.basic to set up little damage.

private void OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hitInfo)
        {
            if (entity is BasePlayer && hitInfo.Initiator is BasePlayer)
            {            
                if (entity as BasePlayer);
                {
                    float damage = 0.1f;
                    hitInfo.damageTypes.Scale(DamageType.Explosion, damage);
                }
            }        
        }
5c2d88ae4ea06.jpg Wulf
I would also recommend digging around Rust's DLLs using a .NET decompiler to see how things work yourself. There's a lot of information in there.

JetBrains Rider already includes Decompiler , Includes Visual Studio Decompiler but my choice is rider, it offers better options

 

5c2d88ae4ea06.jpg Wulf
I would also recommend digging around Rust's DLLs using a .NET decompiler to see how things work yourself. There's a lot of information in there.

In which .dll can i find information about hitinfo?

Oegge

In which .dll can i find information about hitinfo?

Assembly-CSharp.dll contains most elements for Rust. There are a few Rust.*.dll files and Facepunch DLLs that can be useful too.
found it now thank you
Locked automatically