SA-MP Forums Archive
Hp of attached objects? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Hp of attached objects? (/showthread.php?tid=636025)



Hp of attached objects? - LaLy17 - 18.06.2017

Hello guys.
I ask a question. Not really a problem but i have to know before starting a script.

I know we can put Hp to a object with Var. But we can put Hp to a attached object?

Thank you for your support <3


Re: Hp of attached objects? - Abagail - 18.06.2017

I have no idea what you mean by "HP to a var"? Objects don't have health in SA-MP, unless I'm misunderstanding what you're saying.


Re: Hp of attached objects? - LaLy17 - 20.06.2017

Quote:
Originally Posted by Abagail
Посмотреть сообщение
I have no idea what you mean by "HP to a var"? Objects don't have health in SA-MP, unless I'm misunderstanding what you're saying.
Is Player near object tree
Is Player anim chainsaw
Set var --
Var = Health
This is a just a varriable for a normal object but i wanna know if it is possible for a attached object. Now you understand what i mean ?


Re: Hp of attached objects? - Spmn - 21.06.2017

Objects attached with SetPlayerAttachedObject have no collision, so OnPlayerWeaponShot won't get called. I'm not sure about attached global/per-player objects.

However, you can still do some not-so-precise checks whether a player shot an object or not based on the offset reported in OnPlayerWeaponShot and some calculations


Re: Hp of attached objects? - Abagail - 21.06.2017

Quote:
Originally Posted by Spmn
Посмотреть сообщение
Objects attached with SetPlayerAttachedObject have no collision, so OnPlayerWeaponShot won't get called. I'm not sure about attached global/per-player objects.

However, you can still do some not-so-precise checks whether a player shot an object or not based on the offset reported in OnPlayerWeaponShot and some calculations
I think he's trying to detect with a chainsaw, so OnPlayerWeaponShot won't work in this instance. I think GetObjectPos (assuming you're using actual objects) returns the correct position even if attached.


Re: Hp of attached objects? - Spmn - 21.06.2017

Quote:
Originally Posted by Abagail
Посмотреть сообщение
I think he's trying to detect with a chainsaw, so OnPlayerWeaponShot won't work in this instance. I think GetObjectPos (assuming you're using actual objects) returns the correct position even if attached.
Then he can compare both players' facing angle in OnPlayerTakeDamage. It's dirty and very unprecise, but that's all we've got.