-Andreas

Ped wont take damage

Recommended Posts

Hello o/

 

I can't seem to make my ped killable in any way. The API;

streamPed.setCanBeDamaged(true);
streamPed.setInvincible(false);
streamPed.setOnlyDamagedByPlayer(true);

 doesn't seem to do anything. I've tried using natives as well and messed around with the setHealth, getHealth, setMaxHealth & getMaxHealth APIs as well but with no luck. I also tried using relationshipGroups and making the player group able to damage the ped group.(Didn't work) I'm unable to detect the ped on the client event playerWeaponShot as so;

mp.events.add('playerWeaponShot', (targetPosition, targetEntity) => {
    targetEntity always returns null when hitting the ped.
});

So I'm running out of ideas.. Would I have to raycast from my gun when shooting and see if that perhaps hits the ped? Or is there an easier fix for my issue.

Thanks!

 

/Andreas

Share this post


Link to post
Share on other sites
On 5/4/2019 at 1:56 PM, CaptainKanone said:

Have you found a solution?

Use raycasting to detect what ped you're hitting !

Share this post


Link to post
Share on other sites

Have you tried this

streamPed.setProofs(false, false, false, false, false, false, false, false);

 

Share this post


Link to post
Share on other sites
Posted (edited)

 

1 hour ago, Doom said:

Have you tried this

streamPed.setProofs(false, false, false, false, false, false, false, false);

  

OMFG, it works, thanks :D

Edited by taywon

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.