i need help with some things!

Support for MFPS 2.0
Post Reply
User avatar
Luddeisbad
Contributor
Contributor
Posts: 8
Joined: Sat Sep 11, 2021 9:57 pm

1. how do i get when the player is taking damage?

2. how do i fix so the player don't shoot while running/sprinting :mrgreen:

3. how do i get what the player is shooting?
User avatar
Lovatto
Admin
Admin
Posts: 1755
Joined: Sun Dec 07, 2014 3:18 pm
Contact:

Hi,

1. There is not an event for this, but you can easily one:
add this code in bl_EventHandler.cs:

Code: Select all

    public static Action<int> onlocalPlayerReceiveDamage;
    public static void DispatchLocalPlayerReceiveDamage(int damage) => onlocalPlayerReceiveDamage?.Invoke(damage);
Then in bl_PlayerHealthManager.cs -> SyncDamage(...) -> add this line:

Code: Select all

 bl_EventHandler.DispatchLocalPlayerReceiveDamage(damage);
inside this :

Code: Select all

if (DamageEnabled)
        {
            if (health >= 0)
            {
                if (isMine)
                {
                /// ADD LINE HERE
Now you can subscribe to the bl_EventHandler.onlocalPlayerReceiveDamage
to know when the local player gets hit.

2. Turn off the option in GameData -> Can Fire While Running.

3. You can subscribe to the event: bl_EventHandler.onLocalPlayerFire

Regards.
How to find your Invoice Number: Here
How to find your Order Number: Here
User avatar
Luddeisbad
Contributor
Contributor
Posts: 8
Joined: Sat Sep 11, 2021 9:57 pm

Thanks!

What i meant with the 3rd one was how do i get what the bullet hit :D
Post Reply